Hello,
I have written a code for preventing data entry. But I am getting a
"Run Time error '94': Invalid use of Null"
The code I have written is:
Private Sub Mobile_Phone_AfterUpdate()
Dim NewMobile_Phone As String
Dim stLinkCriteria As String
Dim ClientID As Integer
NewMobile_Phone = Me.Mobile_Phone.Value
stLinkCriteria = "[Mobile_Phone] = " & "'" & NewMobile_Phone & "'"
If Me.Mobile_Phone = DLookup("[Mobile_Phone]", "tblClient", stLinkCriteria) Then
MsgBox "This client " & NewMobile_Phone & ", has already been entered in database." _
& vbCr & vbCr & "Please check client details again.", vbInformation, "Duplicate Information"
Me.Undo
End If
ClientID = DLookup("[Client_ID]", "tblClient", stLinkCriteria)
Me.DataEntry = False
DoCmd.FindRecord ClientID, , , , , acCurrent
End Sub
Please help me solve this problem
I have written a code for preventing data entry. But I am getting a
"Run Time error '94': Invalid use of Null"
The code I have written is:
Private Sub Mobile_Phone_AfterUpdate()
Dim NewMobile_Phone As String
Dim stLinkCriteria As String
Dim ClientID As Integer
NewMobile_Phone = Me.Mobile_Phone.Value
stLinkCriteria = "[Mobile_Phone] = " & "'" & NewMobile_Phone & "'"
If Me.Mobile_Phone = DLookup("[Mobile_Phone]", "tblClient", stLinkCriteria) Then
MsgBox "This client " & NewMobile_Phone & ", has already been entered in database." _
& vbCr & vbCr & "Please check client details again.", vbInformation, "Duplicate Information"
Me.Undo
End If
ClientID = DLookup("[Client_ID]", "tblClient", stLinkCriteria)
Me.DataEntry = False
DoCmd.FindRecord ClientID, , , , , acCurrent
End Sub
Please help me solve this problem