Hi,
I need to sequentially number new records that my users enter into a form. I have RequestID as a hidden autonumber field, but that will be used solely to identify records within the db and the users will never see it. So instead I'm using another field RequestNo and I would like this to increment by one when the user enters a RequestDate.
Having read through some threads on here, I've come up with
This seems to work OK except that starting from a completely empty database the first record is being numbered 0. How do I make it start at 1?
Second thing: once the RequestNo has been set, I'd like to "lock it in" somehow, so that even if the user updates the RequestDate later, the RequestNo will not change.
Thank you.
I need to sequentially number new records that my users enter into a form. I have RequestID as a hidden autonumber field, but that will be used solely to identify records within the db and the users will never see it. So instead I'm using another field RequestNo and I would like this to increment by one when the user enters a RequestDate.
Having read through some threads on here, I've come up with
Code:
Private Sub RequestDate_AfterUpdate()
'Increment the RequestNo by 1
Me.RequestNo = Nz(DMax("[RequestNo]", "tblRequests") + 1)
End Sub
This seems to work OK except that starting from a completely empty database the first record is being numbered 0. How do I make it start at 1?
Second thing: once the RequestNo has been set, I'd like to "lock it in" somehow, so that even if the user updates the RequestDate later, the RequestNo will not change.
Thank you.