Full Version: code to determine the correct reference number for a new record
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
RadioactiveFrog
Hi All,

I would like to have a form that when a new record is created it works out the next reference number relative to certain details..So i would query the table for all the related records, sort those in order and take the most recent record based on the previous reference number and then + 1.

In theory seems easy..but..how would i do that in a form?

Sorry if that is a really thick question!!

Cheers for any guidance,

Graham.
Larry Larsen
Hi
Check out the DMax()..
eg:
=Nz(Dmax("YourFakeNumber","YourTable"),0)+1

HTH's
thumbup.gif
RadioactiveFrog
Hi Larry,

Just found the reply to this!! So sorry for my late reply! Thanks for the advice, i will give it a go and see how i get on!

Much appreciated,

Graham.
Larry Larsen
Hi Graham
NP..

thumbup.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.