Manipulating Fields from Tables in Forms (1 Viewer)

RadioProject

New member
Local time
Today, 18:35
Joined
Dec 16, 1999
Messages
5
I would like to be able to create a new ID Code from a "next available number" field in a "config" table. How do I extract this number from the table, use it in the form (ie in edit controls) and then calculate the next number and then put it back in the table ready for the next item that uses this number?
 

Travis

Registered User.
Local time
Today, 10:35
Joined
Dec 17, 1999
Messages
1,332
If using an autonumber is out try this:

dim lID as Long
lID = currentdb.Openrecordset("Select Top 1 [ID] from [config] order by [id] Desc").Fields("ID")

lID will now be the last ID number used in the config table. You can then manipulate away and then use code similar to this:

me.[ID] = lID
 

Users who are viewing this thread

Top Bottom