Sequencial Number

Z

zachnjoe

I have a shared database that creates and displays a TrackingNumber for the
person to write down. I want to prevent two people from writing down the
same number. On Error, I've figured out how to increment the number when the
database is saved or exited. I would like the TrackingNumber on the form to
increment and notify the person so they write down the correct number.
-------------------------------------------
Private Sub Form_Error(DataErr As Integer, Response As Integer)
On Error GoTo Err_Form_Error

Response = IncrementField(DataErr)

Exit_Form_Error:
Exit Sub

Err_Form_Error:
MsgBox Err.Description
Resume Exit_Form_Error

End Sub
Function IncrementField(DataErr)
If DataErr = 3022 Then
MsgBox "Error#: " & DataErr
Response = acDataErrDisplay

Me!TrackingNumber = DMax("Trackingnumber", "Tbltransactionsdata") + 1
IncrementField = acDataErrContinue
End If
End Function
-----------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top