How to get the value of a record and use it in the code?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I´ve made a query that returns the max value found in a field, type long. So,
that´s just one record returned. But i need to get this value and use it in
my code, because the next insertion in a table should be this value+1. I
don´t need the number of the record, but its value. Does anybody can help me?
 
micave said:
I´ve made a query that returns the max value found in a field, type long. So,
that´s just one record returned. But i need to get this value and use it in
my code, because the next insertion in a table should be this value+1. I
don´t need the number of the record, but its value. Does anybody can help me?


This is typically done using this kind of code in the form's
BeforeUpdate event:

Me.serialnum = Nz(DMax("serialnum", "thetable"), 0) + 1
 
Back
Top