Parameter Query

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

Guest

Hi,

I set up a parameter query that asks the user for a serial number and then
it displays the record matching that number. But if the number doesnt exist
it shows me a blank screen. Is there a way to have it say the information was
not found?

Thank You!

Kurt
 
Hi,

I set up a parameter query that asks the user for a serial number and then
it displays the record matching that number. But if the number doesnt exist
it shows me a blank screen. Is there a way to have it say the information was
not found?

Thank You!

Kurt

The query can't do that, but if you make the query the recordsource
for a form you can.
Instead of running the query, you would open the form.

Code the form's Open Event:

If Me.RecordsetClone.RecordCount = 0 Then
MsgBox "There were no records that matched your criteria."
End If

You can then continue and let the form open with no records, or add
Cancel = true
to the above code and the form will not open at all.
 
Back
Top