send spreadsheet macro

  • Thread starter Thread starter pedro
  • Start date Start date
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.
 
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.)
 
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
 
Pedro,

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