Don't Display queries with Zero Results

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

Guest

I have a number of Edit Queries that I execute as part of an automated
process. I only want to display to the user the Edit queries that have
results. I have done this in the past but cannot find the code I used to not
display queries that had no results. Can someone please point me in the
right direction.

Thanks!
 
You haven't done this in the past, because it isn't possible. Queries have
no inherent "smarts", which just means they can't monitor their own
resultset, and they certainly can't act on stuff. If you want to only
display a query that has results, you have to use it as the RecordSource for
a report, and use the report's NoData event.

Private Sub Report_NoData(Cancel As Integer)
MsgBox "There's nothing to show"
Cancel = True
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 

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