MS Access/Query/VBA question
I have this table layout:
JobID (text field)
NextOrderNumber (Number field)
The table contains this data
JOBID NEXTORDERNUMBER
===========================
BL11 1
BL11 2
BL34 1
BL11 3
I have a query which will return the maximum of the NextOrderNumber field based on the JobID. For example, my query searches all JOBID's matching "BL11" and returns the number "3" (which is the maximum of all JobIDs).
What I need to know is how to assign the value from the query to a VBA variable which will then be written to the table. Example: since my query returned the number "3", I will increment it to "4", then create a new JOBID record (BL11) with the NEXTORDERNUMBER as "4".
Hopefully this question makes sense. My question, then is how can a person assign the results of a query to a variable in VB?
I am wanting to do something similar to this:
myvar = query.max_order_number + 1
Thanks in advance
flynn