Query Criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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".
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top