I have a form that will not allow you to add a new record without an error. Here is the code I have to auto generate a new number
Private Sub Form_Current()
If Me.NEWRECORD Then
On Error Resume Next
Me.CS_NUM = Nz(DMax("[CS_NUM]", "dbo_INV_INFSVC"), 0) + 1
End If
End Sub
I have number 1-4574 and then it goes 493 thru 999 and the next number in line to add is 1000 which already exists in the 1-4574 range. Is there a way to manipulate the code above so that it will add the next available number?
Private Sub Form_Current()
If Me.NEWRECORD Then
On Error Resume Next
Me.CS_NUM = Nz(DMax("[CS_NUM]", "dbo_INV_INFSVC"), 0) + 1
End If
End Sub
I have number 1-4574 and then it goes 493 thru 999 and the next number in line to add is 1000 which already exists in the 1-4574 range. Is there a way to manipulate the code above so that it will add the next available number?