Create New Record & Pass Autonumber To Separate Table
Mar 10, 2008
I have a form, frmSub, that contains the combo box comProducts. I also have two tables, Products and PurchaseDetail. Both tables have the field ProductID.
I want comProducts to create a new record in the Products table, using the input in a field called Product and then to use the value of ProductID to create a new record in the PurchaseDetail table. Ie, so the PurchaseDetail table has a record that links to another record in the Products table via the feild ProductID.
I have a query which displays only the records that match the criteria in the form given before. Now i want to create separate report for each of these records. How should i go about with it? I don't want a seperate form for this purpose, is there any way to do the same with a macro?
I have a quick question that could lead into a longer one.
First off, I am trying to associate tests with a course a student is enrolled in. Would it be better to add a column in the courses table and have a comma separated list of all tests associated with each course or would it be better to create a separate table that has a column for the course and another column for the associated test with that course?
If comma separated fields would be better, how would I handle that in forms? How does one parse that field?
I have 1 table that I duplicated to make 3 tables total. I did this b/c I am trying to create separate columns from the same field and table. The field is Workorder. Each workorder list the workorder number followed by a dash and then code. I am wanting to put all of the workorders with the same code in it's own column.
I have 5 codes that i am searching for. The first column list the workorder and a code (123456789-AD). The second column (123456789-BC). I'm good to this point but my problem occurs next.
The third column i am trying to put 3 types of workorder and it's code in the same column. As follows, (123456789-CD, 123456789-TC, and 123456789-PTC. However, when I do this it takes the results from the 3rd column and applies it to the 3rd column but also the 1st and 2nd column. I tried a UNION query and unless I am doing it incorrectly it does not work.
When I tried paste some data using front end to my database, Access showed error (can't create record because data would be duplicated). I thought it's impossible because it is autonumber field. So I checked it (manually). I did copy of my database and then for testing, I created record. I was shocked. Next record should has a value of "160" but Access gave "130" then showed an error "Can't create record because data will be duplicated". Of course after compact and repair everything is fine.
Hi, I'm new to this forum and have a question: I want to create a table with an Autonumber field using a SQL statement, in Microsoft Access Database, something like this: Cnn.execute "CREATE TABLE newtable (id Long, Name Char(100)) " is there something to put in place of "long" to make the field autonumber? I tried the word "autonumber", but did not work.
I have a table where one field needs to be an autonumber, however, that autonumber needs to be calculated. This field is not based on any other information in the database, but there's a very complicated mathematical process behind it, which I'm figuring out...I just need to know once I get that code complete, how do I tie it into the table?
I am trying to create a make-table query, with a new AutoNumber field.
I know that if you are creating a new Text field you type FieldName: "" in Field and for a Number field you would type FieldName: [], but what do you type for an AutoNumber field?
I have a form where a user can change the scheduled start date for a job. On a sub form on the same screen is a list of notes relating to that job.
Any notes added, automatically have todays date and are locked when the user clicks off.
When the scheduled start date is changed I need a note to be made. Either forced, then entered by the user or automatically.
I was thinking of making the scheduled start appear in a small form and the button to make it come up could add a new note on the click event (possibly in a message).
Or even better (probably harder) any time the value is changed in the form a new note is added.
Other options could be a pop up form to add one note on a change.
I have the requirement to write EACH record from a table to its own CSV file with name of the file being combination of 2 fields
So let's say I have Table1 with 3 columns (Field1, Field2, Field3) with following content :
Field1 Field2 Field3 AA 1 ABC AA 2 DEF AA 3 GHI
I should get 3 files with names AA1.CSV, AA2.CSV and AA3.CSV and each file contains its respective row from the table.
I tried to do it with DAO Recordset, but I do not find a way to write only the current record from recordset while looping.
See below the code I was using, but issue is that code does succesfull creates the 3 CSV files as per above example, but in each file it writes ALL 3 ROWS instead only the respective ROW.
Code: Dim db As DAO.Database Dim rs As DAO.Recordset Dim strSQL As String Dim strFilename As String
I have a database that is used to allocate appointments to our staff. It has 2 tables, one that lists the clients we need to call in that day, and another that stores details of each contact attempt. I'd like to design a query that find all clients who we have not dealt with so we can easily get their details in a list. I know what the criteria for the query would be, but I'm stuck for how to actually execute it. Here are the details.
Table tClients stores the current clients - primary key is named "clientRef" Table tContactEvents stores each contact attempt and the date/time is stored in a field named "dateTime".
When an entry has been dealt with successfully a yes/no field named "completed" will be set to "Yes".
There may be many attempts to contact a specific client on a given day, unsuccessful attempts will not have the completed flag set.
Once the completed flag is set that client will be ignored so no further entries will appear.
So I need a query that searches tContactEvents for the most recent match to each number in tClients.clientRef and checks if the completed flag is set. If the completed flag is false, or if the number has no match (i.e. no contact attempts made yet) then the clientRef should be displayed. I also need this to be restricted to the current date, as the same client could have rebooked their appointment to a different day.
I have a form that the user can add Work Order numbers to a text box and pass them to a listbox to collect 1 or more values. Each of which need a separate report with the labour hours for each Work Order.
I am having issues figuring out how to get it to pass them to a query or filter the reports.
I have tried many different examples and nothing seems to work.
I had a backup from a table that I saved to excel. Somehow we lost all the records from the table 10 minutes later. There where gaps in the id numbers due to some delete records in the past, and when I did try to put it back in the access table the records some how shift. is there a way of still using the ID nr that is an autonumber in the table and when I set the data back from excel and use the append when paste that they show up correctly? Maybe I can set the autonumber to start from the last record on the table?
I want to be able to take two separate queries to create a 2 line graph. Also to be able to spice the graphs up some. The ones I have done, single line, even seems dull.
I've created a custom ribbon and it works great however I want to create a separate ribbon and attach it to the report. On this particular ribbon, I'd like the export to excel, export to word and print functions to appear ONLY for reports. Not all reports will need to be exported; it depends what the user does. I've created this XML and I'm not receiving any error message. It loads as expected but my group is blank/empty. Still confused.
The interface being used is a main form with various tabs and a subform on each of these tabs.
There is one field ('max power density') in my database that is calculated using 'Max Rated Power' and 'Cylinder Capacity' however these are in different tables and subforms. The 'max power density' and 'max rated power' are in table and subform 1 but 'cylinder capacity' is in table and subform 2. Is it possible to keep them in separate tables/subforms and still calculate the field?
I have a sales report that I generate each week based on a query, which relies on the input from a combo box on a form. This works great - but I have select each salesperson, one at a time and run their reports separately.
I'd like to have some code that will run through each person on the list, generate their report, create the PDF, and email (or save) the file.From my initial research, it appears I will need to utilize a List Box (vs a combo box), so I can select multiple salespersons for the report.
I've found a few examples of code to use...but a little lost on how to implement. I create a new form with a list box that queries the property table for the list. I then added a button to execute the code, and attempted to add this (with my control and reports names substituted). Getting all sorts of errors -- so not sure I'm on the correct path.
'Posted by ADezii 5.23.2009 on bytes.com 'Modified by Gina Whipp 11.4.2009 to OutputTo Multiple Files 'Tested in Access 2003 with a Combo Box
Dim intCounter As Integer Dim cboCode As ComboBox Set cboCode = Me![ YourControl ] 'If Your Data Type is Numeric use this section
I currently have a few tables that use an autonumber as the primary key, however, I would like the autonumber to start with a series of letters if possible. For example: instead of it creating an ID of 1, then, 2, 3, 4, and so on, I would like it to append lets say "ABC" to the front of it; ABC1, ABC2, ABC3, etc.
each time i run the query i need to list that guests, their number of falls and assign each unique guest a number starting with 1 on up...
How? yes, yes, i know how to do it in a report, but I need right now to be able to do it in a query alone.. anyone?
I tried: SELECT Sum(1+), Guest_Name, Account_Number, Count(Account_Number) AS [Falls] FROM tblFalls GROUP BY Account_Number, Guest_Name;
=p no luck.. though it looks neat.
I also tried writing a function
Public Function GetQryNum() As Integer If IsNull(gQryNum) Or gQryNum < 1 Then gQryNum = 1 GetQryNum = gQryNum Else gQryNum = gQryNum + gQryNum GetQryNum = gQryNum End If End Function
SELECT GetQryNum() AS GuestIndex, Guest_Name, Account_Number, Count(Account_Number) AS [Falls] FROM tblFalls GROUP BY Account_Number, Guest_Name;
Hi I am trying to make a database, In which I have a table linked with the form. There are two fields in the table 1.Serial Number & 2. Current Year I want the serial No. field to be incremented after every record is added & Also the numer should start from "1" again as the Current Year Changes. Can somebody help me in this. I am learning new things in access & not that proficient. But i love to work in access.
I created a database of "My Cars", "Television", and "Wines" and a Trouble Reports(TR) for each. I have a field TR on each and for now a user can fill it up with number i.e first TR is 1, second Tr is 2 etc etc. I want it automatically filled automatically not manually. However, I want it to do the same for "Television" and "Wines" when I write Trs on them. I am a rookie and I dont know how to do it I attached a copy of the db I created.