Query Criteria

C

cwilkey

I have a query criteria set up ([Please enter Employee ID]). The query works
fine however is there a way to prompt the user if the criteria doesn't match?
Currently if you enter a value that doesn't exist it just brings up an empty
row. Idealy, I would like to throw up a message box that says "Invalid ID,
try again".
 
G

Guest

hi,
with the prompt for criteria in the query, no.
you could put a sub in a form that could check the id and
prompt the user that the input is invalid.

If IsNull(Me!txtEmpID) Then
Cancel = True
else
If (IsNull(DLookup("[EmpId]", "youtable", "[EmpID]
='" & Me!txtEmpID & "'"))) Then
'the if statement above should be 1 line
MsgBox (" Employee does not exist.")
exit sub
end if
end if
 
Top