Stopping empty reports from being created

  • Thread starter Thread starter Wendy
  • Start date Start date
W

Wendy

Hi

I have a module which produces several reports the problem is it produces
the report with the word #error when there is no data. Is there a way to
stop it producing these reports and just the ones with live data in them?
There is no way of knowing which ones will have data in each day.
I really wanted them to output into word but the header, footer, pictures
and sub reports don't print out, is there some way to make that work too?

Thanks

Wendy

Sub createprtfiles()

DoCmd.OutputTo acOutputReport, "rptNLG", acFormatSNP, "C:\Other\G.snp"
DoCmd.OutputTo acOutputReport, "rptNLGA", acFormatSNP, "C:\Other\GA.snp"
DoCmd.OutputTo acOutputReport, "rptNLR", acFormatSNP, "C:\Other\R.snp"
DoCmd.OutputTo acOutputReport, "rptNLRS", acFormatSNP, "C:\Other\RS.snp"
DoCmd.OutputTo acOutputReport, "rptNLRM", acFormatSNP, "C:\Other\RM.snp"

End Sub
 
Reports have a NoData event that gets fired if there's no data to display.
In that event, cancel the report. Note that you'll have to trap the error
that'll be returned to createprtfiles. Since you've got nothing else in that
routine than OutputTo calls, you should be able to get away with putting

On Error Resume Next

as the first line in the routine.
 
Back
Top