can't get rid of a blank report

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

Guest

I have a macro that opens a report and then I email the
result. If the report is blank I get a type mismatch
error 3 times. I believe the 1st one is when it is
opened and the 2nd when it is printed and the 3rd one
when I try to email the report.

I have to print a report for 50 differnt accounts and my
macro looks like this

open report (with condition acct number = 1000 and date =)
send object
close report

open report (with condition acct number = 1001 and date =)
send object
close report

etc....

If there is no records for a specific account number in
that date range how would I stop the macro from giving me
the type mismatch errors.

Thanks for all of the help!!!
 
Cancel the NoData event of the report.

That will probably give your macro a different error, saying the OpenReport
was cancelled (error 2501). To avoid that error, you need to use VBA code
instead of a macro, and include error handling that just ignores that error.
One of the most severe limitations of macros is that they contain no error
handling.
 
Back
Top