Hi all, I am new to working with databases. My question is, how do you retrieve the autonumber ID of a field for a row just inserted into a database.
I have read numerous threads/articles, but none give me a clear picture of what the code actually looks like, just pieces(which is like greek to me). Could somebody tell me where I can see a working example of the code?
I am trying to use the template provided in the Access database wizards, pages and projects. Its called Order Entry. What i would like to do is edit the template to fit my needs but i need to change the Product ID feild from Autonumber to a product id of my own. I would however like to keep it as the Key.
I am trying to use the template provided in the Access database wizards, pages and projects. Its called Order Entry. What i would like to do is edit the template to fit my needs but i need to change the Product ID feild from Autonumber to a product id of my own. I would however like to keep it as the Key.
I am trying to change my autonumber field to start at 2000500 for a workorder ID instead of 1. I have read the instructions but still don't sem to understand. Can someone give a more detailed set of instructions than is currently in the online access help?
I have a database which I can add to, edit and delete via an asp.net page, it also allows me to add html tags. My problem is when the data is then rebinded to the page any HTML tags are changed from '<' to '<' and from '>' to '>' this results in the tags and contents being displayed on the page as text instead of being interpreted as HTML and then formatting the page - most frustrating!
Any help is greatly appreciated, this is a relatively new area for me so many thanks in advance.
Hopefully someone can help me this (and hopefully the solution isn't staring me in the face)
I am trying to export data from a cell in a worksheet to a field in an Access database that I am building. The database has two tables, tblCompanies and tblQuotes. It works through a macro accessed by a command button, which should export the total of a quote into the field Quote_Price in the tblQuotes table, which the users will access through a form. The problem is that if I export the data from Excel, I get an error message saying, "You cannot add or change a record because a related record is required in table 'tblCompanies'. The code looks like this:
Sub NewQuote()
Dim cn As ADODB.Connection, rs As ADODB.Recordset, r As Long ' connect to the Access database Set cn = New ADODB.Connection cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _ "Data Source=C:Documents and SettingsDJEdwardsMy DocumentsTest Foldermarketing.mdb;" ' open a recordset Set rs = New ADODB.Recordset rs.Open "tblQuotes", cn, adOpenKeyset, adLockOptimistic, adCmdTable r = 55 ' the start row in the worksheet Do While Len(Range("I" & r).Formula) > 0 With rs .AddNew .Fields("Quote_Price") = Range("I" & r).Value .Update ' stores the new record End With rs.Close Set rs = Nothing cn.Close Set cn = Nothing End Sub
I can import the cell contents from Access with no problems, but I would like the user to be able to do it from Excel to simplify things.
I am using VB.NET 2003 and MS Access XP for a desktop application. While developing the application we have a reached a situation where we want to print a report which retrieves records from four tables. Till here it is easy to think that it can be done by a simple SQL JOIN query, but following is the complexity:
The first table stores a single row. The second table stores multiple rows related to the Primary Key field defined in Table One. The third table stores a single row related to the Primary Key field defined in Table One. The fourth table stores a single row related to the Primary Key field defined in Table One.
The above SAVE RECORD option is performed when a user fills a Form of my application. As stated above, all the four tables are inter-related with a Primay Key field (TNo) defined in table one.
I also have a MS Access Report that will print information retrieved from all the four tables. The Report has some of the fields from each of the above table. The SAVE operation is performed in this way:
(1) A unique TNo is generated for a new record that is about to be created. (2) All the entries are saved in their respective tables (mentioned above.) (3) An access query will fetch the records pertaining to this TNo from all the tables to fill the report.
I want to know how to write such a query when I have to fetch multiple rows of a table in between. Is there any way that I can pass the TNO as a parameter to this query that is saved in MS Access?
I'm designing a database for work and am using buttons instead of the navigation features already standard with access.
I need some form of code?? for my button. I want a user to be able to click this button when finished entering data; access will then save the data, close the form and return the user to a main menu, like a switchboard.
Any suggestions or indeed code, lol, would be very helpful
Ok, I've been given a task to create a hierarchy diagram for my company, unfortunately the diagram has to be created using one excel spreadsheet. I would prefer it if the database could be created using the smallest amount of user input, so all he user has to do is import the spreadsheet to access and hit a button then the hierarchy is created.
I'm currently only going one step at a time, trying to sort the data from the spreadsheet using queries. But this is the problem:
Raw Data table ID, Firstname, Lastname, Status, SupervisorFirstName, SupervisorLastName
The idea is that the hierarchy diagram should start with the boss and move down to the mere siblings like me, and everyone will be connected. But for one reason or another this isn't the case, so at the moment I am trying to move the persons record if their supervisors name is not in the tree, so the SupervisorFirstName and SupervisorLastName are not in the Firstname and Lastname column.
I have been using the following SQL
INSERT INTO Table1 ( ID, LASTNAME1, FIRSTNAME1, Status1, SUPERVISORLASTNAME1, SUPERVISORFIRSTNAME1 ) SELECT ID, LASTNAME, FIRSTNAME, Status, SUPERVISORLASTNAME, SUPERVISORFIRSTNAME FROM RawData WHERE (((RawData.SUPERVISOR_FIRST_NAME)=FIRST_NAME) AND (RawData.SUPERVISOR_LAST_NAME)=LAST_NAME);
When I change the LastName to "SMITH" I know how many records I should get and it works, but how can I go through both columns finding any matches??
I may have described this quite badly so if you need any more info please let me know.
I'm just having a dabble in VBA for Access so I'm fairly newbish!
I have a field [Reference Number] that increments in the table by 1 everytime - but the user has to enter this manually (its not auto-incrementing). How can I do the following: when the user selects a new row in the table it will automatically look in the table for the last entered [Reference Number], increment it, and put that value in the Userforms TextBox??
I hope this is the correct place for this type of question.
I have two tables, let's call one the "record table" that holds each record of interest. Let's call the other one the "rule table," as each entry is a "rule." The two fields of the rule table are rule and description.
I have a form with a list box and a text box. I'd like the user to be able to choose a rule from the list box and this would control the "rule" field in the current record. However, I'd like the text box to display the description corresponding to that rule, by looking it up in the rule table.
I know I've probably made it sound very complicated, but I assure you I'm trying to do something very simple here. Thanks for any help anyone can give me!
I am fairly new to Access, so please bear with my hopefully easy to answer questions. I am trying to create a database for a university where we input all of our student leaders information (name, email, student ID number, etc) along with the groups they are involved with so we can track and see who is involved with alot, and so we have easy access to their contact info if we need to do that. Anyway, I have already created a database to take in all the information and spit out the reports. It is probably pretty messily put together, but like i said, this is my first time working with Access on this scale.
My question is, when I created a report to display all the students involved with a specific activity, I ran into a bit of a problem. There are two students with the same last name, and for the activity in question, they both should be shown. However, it only shows one of their names (I have it set to show the last, first) but it shows both of their activity status. What am I missing to be able to split the names show its shows both names?
Here is a link to download the access file, and perhaps someone can tell me how to fix it.
I am trying to learn first how do i lock a db so that it will keep users from tampering with the forms and queries, second i am trying to learn how can i transfer the form, queries, etc. to a new ms access database without having to recreate them all over again. I recieved updates from a source of mine and it contain new information, the old database is archived. And the new db with new information is keep separate from the old information in the new database so i had to recreate the form everytime.
I have a table (Master) that contains columns such as MsgLocation, MsgName, MsgScript, and MsgTxt. I want to create a form where the user would have an area to type in a 'string' and when they hit enter (or select a button), a (background) query would execute a lookup on master "where MsgTxt LIKE %string%"... For example, if a user wants a list of all MsgTxt values that contain "Please hold" they would type in a box "Please hold" and the query would use %Please hold% in the search criteria.
I don't have a clue on the first thing to do to get this done. And I'm new at this...
I'm new to ASP and I need to connect my webpages to an Access database I have created. I would do this in dreamweaver normally but I'm having trouble using the custom connection string function to do this. So I was hoping someone could explain how I would do this by coding it instead. The code my web host provide to connect to a database is below. If someone could explain to me how I would use this to connect to a database, I would be very grateful. Thanks. Quote: Dim oConn, sConnection
Hi to everyone firstly! i am a firefighter, we have a set number of personnel on my watch, we work 3 days of duty, each day of duty each member of the duty crew are allocated tasks, not everyone can do all of the tasks!
the tasks are :-
one person drives the fire truck one person drives the aerial ladder fire truck one person fills the other crew position on the aerial truck one person is the duty-man for the day
not all personnel can do everything, some don't drive, some can't drive the aerial truck but can be the other crew position
if we have more crew members than we need one or more may be sent out to another station
what i want to know is can a data base be set up, entering data to state who did what on each actual duty day and then the database will make a report to say which watch member is next to take a turn in each position?
there a some variables, some can't drive any fire truck, some can drive the fire truck but not the aerial truck and two personnel can't be on the aerial truck who can not drive it!
sorry if it doesn't make sense!!!!
i do have a vague outline knowledge of access, i can fill tables create forms and switchboards, do basic queries and reports
Hello, i have a frontend DB linked to a backend DB wich contains tables, and i want to create 2 kinds of profile : those who can do everything (add,delete,update) and others that can only consult. Here is my question : is there an object to see if i am using the profile 1 or profile 2 and can i swap them using VBA code when i launch my program DB ? Thanks in advance for help. VINCENT
Hoping some one could assist me? I am busy designing a database which I am going to put in access.
I have designed the tables and am now not sure how to link them. I was given an excell spreadsheet with headings and am now trying to make this into a database. Example : I was given Co-ordinator Name - Which I now split up into:
Now there other fields like this , for example Regional Manager Name - which I have split up as above into a seperate table.
These fields all relate back to one Code - Called District
There are also a fields which needs to show the a fee required the fee paid and fee outstanding/balance .
The rest of the information required I can create check boxes for , I hope! Anyway my question is how do a relate all these different tables together? This is my mental block. And the check box tha information - is it stored a another table? I hope I am explaining my self correctly and I hope some one can make sense of my question
First, if I have a table, and I want to combine two records together, how would I accomplish this? For example, say I have the following table.
NAME SALES Bill 2000 Jim 500 Ted 1000
And by some miracle of science, Bill and Jim are able to fuse together to become Jill, combining their sales together. So the new table would look ilke this.
NAME SALES Jill 2500 Ted 1000
My second question is, say I have an extended list of the same table with 30 names and corresponding sales. However, I want to find out Ted's percentage of sales of the TOP 15, not all 30. How can I accomplish this?
Thanks so much in advance for helping out a complete newbie. :)
Hi all. I am fairly new to access and am trying to do something that shouldn't be that hard. I have a simple form with one text box and a command button on it. I have the command button set to run an update query.
My problem is that when I enter data and press the button, I don't know how to get the entered data into the query?
I know this is simple to do, but since I am new to access, I can't figure it out. Does anyone have a simple example or step by step details that they can share with me?
just finding my way in Access 97 with no real support. I have made a query that creates duplicate records when I only need to see one for a certain criteria (lets say criteria X). This is due to the data feed involved in making the query where criteria X is found in numerous records.
What I want to display is only one record per entry containing an exact match for criteria X.
Finding it hard to articulate this but I would need something that defines:
If criteria X is the same, just display one record.
Hope this is somehow clear as I am struggling a bit. Would be gratefull of some help.
Hi, okay completely new to access. I'm trying to create a chart based on a query with 1 record 8 fields. I can not figure out a way to rearrange the data into two fields 8 records.
The background is I have a hundred units, each with 8 wheels. I have a table with the following fields. -Unit part number -Diameter of wheel 1 -Diameter of wheel 2 -Diameter of wheel 3 -Diameter of wheel 4 -Diameter of wheel 5 -Diameter of wheel 6 -Diameter of wheel 7 -Diameter of wheel 8
So, the query tells me how many wheel diameters between a certain range, with the following fields: - Diameter >530 - 530> Diameter >540 - 540> Diameter >550 - 550> Diameter >560 - 560> Diameter >570 - 570> Diameter >580 - 580> Diameter >590 - 590> Diameter >600
Now I want to plot the range on the x axis and # wheels in that range on the y axis of a bar chart.
Any suggestions on how I can achieve this? How do I create the diameter range as a record rather than a field?
I’m trying to create a DB with some field validations. I have a field named ‘Value’ and a field named ‘Doubled’. Value is in a currency format. ‘Doubled’ is in a Y/N format. I want a to create a rule that prevents the value ‘Yes’ from being entered in the ‘Doubled’ field IF the value in the ‘Value’ field is greater than .60. How do I do that?
I entered "[Value]< .6" but that wouldn’t allow me to put any value in the ‘Value’ field – it popped an error every time.
I have a request from work to create a button that will allow only certain fields from a record, ie tracking number, to be sent to that client's email in the record by adding a button to the form that will automatically send the field.