You don't say what you want to do in case an attempt is made to enter a duplicate bill, so we'll use the line
Me.Undo
to undo what you've entered. If this is not your intent, simply omit this line from the code below:
Code:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Dim Message As String
If DataErr = 3022 Then 'Duplicate Bill entered
Message = "You Have Attemped to Enter A Duplicate Bill"
Response = MsgBox(Message, vbExclamation, "Duplicate Bill")
Response = acDataErrContinue
Me.Undo
End If
End Sub
Linq ;0)>
Moderator Note:
This thread is related to an earlier thread by the OP. The error in question is 3022, attempting to enter a record with Duplicate data in the Primary Key.
Comment