G
Guest
The procedure below is intended to identify double entry if both the supplier
and invoice no of the new entry are the same as previous records. But it is
not working properly. Please help.
Private Sub Invoice_No_BeforeUpdate(Cancel As Integer)
Dim x
x = DLookup("[invoice no]", "
", "[invoice no] Like '" & Me![invoice
no] & "'")
Dim y
y = Dlookup ("[supplier]", "
", "[supplier] Like '" & Me![supplier] &
"'")
If IsNull(x) and IsNull(y) = False Then
Dim Msg, Style, Title, Mystring, Response
Msg = "A C C E P T A B L E ?"
Title = "R E P E A T E D E N T R Y"
Style = vbYesNo + vbCritical + vbDefaultButton2
Response = MsgBox(Msg, Style, Title, Response, Mystring)
If Response = vbYes Then
Mystring = "Yes"
Else
Mystring = "No"
Cancel = True
End If
End If
End Sub
and invoice no of the new entry are the same as previous records. But it is
not working properly. Please help.
Private Sub Invoice_No_BeforeUpdate(Cancel As Integer)
Dim x
x = DLookup("[invoice no]", "
no] & "'")
Dim y
y = Dlookup ("[supplier]", "
"'")
If IsNull(x) and IsNull(y) = False Then
Dim Msg, Style, Title, Mystring, Response
Msg = "A C C E P T A B L E ?"
Title = "R E P E A T E D E N T R Y"
Style = vbYesNo + vbCritical + vbDefaultButton2
Response = MsgBox(Msg, Style, Title, Response, Mystring)
If Response = vbYes Then
Mystring = "Yes"
Else
Mystring = "No"
Cancel = True
End If
End If
End Sub