HELP please (1 Viewer)

J

jenkinsdm

Guest
I am absolutely new to access programming..I'm rather good at FoxPro programming and have the habit of trying to see access as FoxPro. I have a problem : I would like to store the value of a certain field to a public variable from within a VBA procedure. The variable is already declared as public but the table is not open. E.g : I am creating a new invoice and want to pick up the next Invoice number from a field in my control table which is not included in my query - how do I do it? If this is clear I would appreciate your help. Thanks.
 

Travis

Registered User.
Local time
Today, 05:41
Joined
Dec 17, 1999
Messages
1,332
set your variable like this:

YourVariable = (Currentdb.OpenRecordset(Select Top 1 [ID] from [tblYourTable] Order by [ID] Desc",dbOpenSnapshot)) + 1

This will get the last ID number and set your variable to = LastID +1
 

Users who are viewing this thread

Top Bottom