Reputation: 1
I have code behind my Save button that generates a Change Request Number upon the record being saved. So let's say:
Is there a way to edit the record and keep the same Change Request Number ?
I have been trying to look up functions but I haven't coded anything in Access in a long time, I just need some help.
If Me.NewRecord = True Then
Me.Change_Request_Number = Nz(DMax("[Change Request Number]", "Change Requests"), 94) + 1
DoCmd.RunCommand acCmdSaveRecord
Upvotes: 0
Views: 28
Reputation: 21379
Instead of checking for new record, could check if the field or textbox is Null. This assumes the field is not set with 0 as DefaultValue.
If IsNull(Me.Change_Request_Number) Then
Me.Change_Request_Number = Nz(DMax("[Change Request Number]", "Change Requests"), 94) + 1
End If
DoCmd.RunCommand acCmdSaveRecord
Upvotes: 0