If result of query is nill

puthenveetil

Registered User.
Local time
Today, 20:23
Joined
Aug 9, 2004
Messages
94
Hi all,

Is there any way to show a message if a query can't find any record with a criteria????


Thanks in advance

Thanks
 
I use the OnNoData property of the report.

Col
 
If it is not a report, but is instead on a form, you will get a visual indication that nothing came back 'cause your form will be blank.

If this is in VBA then there is such a thing as testing the recordset to see if it is simultaneously at EOF and BOF (both properties set to Yes at the same time.) That's a dead giveaway of no records.
 
Place the following code on the forms On_Open event

Code:
If Me.RecordsetClone.RecordCount = 0 Then
    MsgBox "There are no items to display", vbInformation
    DoCmd.Close acForm, "Name of Form"
End If
 

Users who are viewing this thread

Back
Top Bottom