I have a form for data entry
when the user puts a duplicate data into the field food_cart_no he will get a notification box that this number already used, and after he clicks ok it supposes to open the existing data. but it is not loading
any help please
Code: Select all
Private Sub Food_cart_NO_AfterUpdate()
Dim Prevent As String
Dim Prevent2 As String
Dim Prevent3 As Integer
Prevent = Me.Food_cart_NO.Value
Prevent2 = "[Food_cart_NO] = " & "'" & Prevent & "'"
If Me.Food_cart_NO = DLookup("[Food_cart_NO]", "Poor", Prevent2) Then
MsgBox "This Food Card No ," & Prevent & ", has already been entered in Database." _
& vbCr & vbCr & "please chek name again.", vbInformation, "Duplicae information"
Me.Undo
Prevent3 = DLookup("[ID]", "Poor", Prevent2)
Me.DataEntry = False
DoCmd.FindRecord Prevent3, , , , acCurrent
End If
End Sub