send spreadsheet macro

P

pedro

I have created a macro to send a spreadsheet to various email recipients.
The macro works OK, but I also wanted to include a condition in the macro so
that if the query that generates the spreadsheet did not return any records
then the macro would cancel and a message box would display something like
'No records for today'

Thanks for your help.

Pedro.
 
S

Steve Schapel

Pedro,

In the Condition of the macro, put the eqivalent of this:
DCount("*","NameOfYourQuery")>0

(If you can't see the Condition column in macro design view, select it
from the View menu.)
 
P

pedro

hi Steve,

Is it also possible to do this if I am sending a report by email. The report
is based on the same query I am using to send the spreadsheet. Would I need
to include the name of the report in the Dcount expression?

thanks again,

Pedro
 
S

Steve Schapel

Pedro,

No. You would apply the DCount() condition to the query that the report
is based on.
 

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

Top