get result from a query

K

Karen

I want to get the results of a select query (it shows me the highest value
in a field) and add 1 to that value and then write the new value to a field
in another record.

Any ideas?

Karen
 
S

Sprinks

Hi, Karen.

I think the easiest way to do this is to use the DMax function (see VBA
help). For example, the code to go to a new record and assign the next order
number on opening an Orders form would be:

' OrderNumber is numeric, but not an AutoNumber
DoCmd.GoToRecord , , acNewRec
Me!OrderNumber = DMax("[OrderNumber]", "Orders") + 1

Hope that helps.
Sprinks
 
Top