Is there a way to have DLookup using two fields? For example, If fieldA & fieldB existed, then msgbox "duplicates records". cancel, undo...etc. But if fieldA existed but not fieldB then it's ok to go on. What would the DLookup statement look like?
This is the code I've used for looking up one field, but not sure how to make it work with two criterias.
__________________________________________________________
If (Not IsNull(DLookup("[DocNum]", "UsystblTrainReq", _
"[DocNum] ='" & Me!DocNum & "'"
)) Then
msgbox "Document number has been used."
Undo
Exit Sub
End If
__________________________________________________________
Thanks
This is the code I've used for looking up one field, but not sure how to make it work with two criterias.
__________________________________________________________
If (Not IsNull(DLookup("[DocNum]", "UsystblTrainReq", _
"[DocNum] ='" & Me!DocNum & "'"
msgbox "Document number has been used."
Undo
Exit Sub
End If
__________________________________________________________
Thanks