Having issues with increment

dogman01

Registered User.
Local time
Today, 07:42
Joined
Dec 3, 2008
Messages
47
I have 2 tables and they are linked. Main table holds lets say a "Main" log record which is input from a form. The linked second table holds multiple records associated with it's Main record. They are input from a sub-form that has been inserted into the Main form. If i am in the subform of a main record, there is a field that is a number field and it holds values like 001, 002, 003 etc. What I need is a way that once a user has created a Main record and is in the subform of that main record to enter it's cooresponding individual records how do I get the "number" field to increment by one each time they enter the record. Of corse then when they are done and begin a new Main record and begin it's sub records the first record starts as 001 again and increments. Can this be done?? Hope I explained this half !?@@:D
 
Look into using the DMax() function to get the highest assigned value so far in your subform recordset (can be a query that hits the same table with criteria on your PK/FK fields), and then add 1 to the value returned.
 
Little confused. Subform only shows me the records that are linked to it's main record. I think you are on the right track though but not sure what you mean about a query that only shows linked records
 

Users who are viewing this thread

Back
Top Bottom