Stopping empty reports from being created

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
 
D

Douglas J. Steele

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.
 

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