search query null results (1 Viewer)

Matt Brown

Registered User.
Local time
Today, 20:11
Joined
Jun 5, 2000
Messages
120
Is it possible to stop a query running if no results were found in the search.

I have a form with a query behind it which i use to filter data from a search form.

If the query returns no data on to the search results form then instead of showing a blank form can it either display a message or return back to the main form.

Any help would be appreciated...

thanks

Matt
 
R

Rich

Guest
Private Sub Form_Open(Cancel As Integer)
If (RecordsetClone.RecordCount = 0) Then
DoCmd.Close
Beep
MsgBox "There is no information for that period.", vbInformation, "No Info Recorded"
End If
 

Matt Brown

Registered User.
Local time
Today, 20:11
Joined
Jun 5, 2000
Messages
120
Thanks Rich,

Works just fine.

Matt
 

Users who are viewing this thread

Top Bottom