View Full Version : Printing report but only is applicable


Stemdriller
06-10-2010, 01:42 AM
Hi People

Can we tell Access that if a certain report has no data, do not print the report.

I have 4 reports that print off at the same time, but sometimes some of the reports will have no data, so I am trying to not print it.

Any ideas?

Gareth

vbaInet
06-10-2010, 01:45 AM
Perform a count of the records using DCount() and if it's greater than 0, print, if not move to next report.

DCount() function:
http://www.techonthenet.com/access/functions/domain/dcount.php

Vomba
06-21-2010, 07:40 AM
Or in the NoData event just type

Cancel = True

Unless you have a specific reason for not using this method, obviously!:D

vbaInet
06-21-2010, 07:47 AM
Or in the NoData event just type

Cancel = True Unless you have a specific reason for not using this method, obviously!:DLol yes. You would need to trap for the 2501 error using this method which is thrown by the OpenReport method due to the action being cancelled.

But good point though if the OP wants to use this too!