I have a pop up form that asks the user to input a works order number that then opens the relevant record, if a number is added that doesn't exist that this just opens to an empty form, i would like a msgbox to say sorry no record exist etc i
this is the code i have used
If (Not IsNull(DLookup("[WorksOrderNumber]", "WSbyWorkRequest", "[WorksOrderNumber] ='" & Me!WorksOrderNumber.Int & "'"
)) Then
MsgBox "Data Entry Error"
Cancel = True
Me!WorksOrderNumber.Undo
End If
this gets stuck on the cancel = true line of code saying variable not defined any ideas where i am going wrong CJB
this is the code i have used
If (Not IsNull(DLookup("[WorksOrderNumber]", "WSbyWorkRequest", "[WorksOrderNumber] ='" & Me!WorksOrderNumber.Int & "'"
MsgBox "Data Entry Error"
Cancel = True
Me!WorksOrderNumber.Undo
End If
this gets stuck on the cancel = true line of code saying variable not defined any ideas where i am going wrong CJB