get result from a query

  • Thread starter Thread starter Karen
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top