Show last record ID#

Maggie23

Registered User.
Local time
Today, 01:16
Joined
Jun 18, 2002
Messages
19
When I enter a new record's data on a form I would like the ID# I had entered for the last record to show up - so I know which ID# to use next. I want to see the last ID# entered everytime I use this form. Can someone tell me how to accomplish this?
(Also I can't use autonumber in the ID field since numbers I have to use are unique but not sequencial.) Thank you.
 
In the On Current event of the form:

If Me.NewRecord Then
On Error Resume Next
Me.MyLastNumber = Nz(DMax("[MyNumber]", "MyTable"), 0)
End If

MyLastNumber would be an unbound control on your form. Change MyNumber to reflect the number you want from your table and change MyTable to the name of your table.

hth,
Jack
 

Users who are viewing this thread

Back
Top Bottom