Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check whether query will return records before invoking vba 1

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
579
0
16
GB
Hello I need to check whether a query will contain records before carrying out a task.

Is there a way to check this?


Ie. I want to email a list of clients from a query.

If however the query will have no records, then I do not want
to run the email code.

I don't want to physically open the query on screen, so is there
a way to open the query, check for records and then carry on only
if there are records?


Many thanks Mark.
 
Use VBA to check for a positive value returned from DCount with the same criteria as your main query?

If >= 1 you cvan then send your email, otherwise display a "No matching clients found" message to the user.

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top