Print report with zero records (1 Viewer)

glgaunt

New member
Local time
Today, 12:26
Joined
May 17, 2011
Messages
2
I have a report that has sub-reports in it. Each sub-report is based on a query. In the print preview it will show any sub-report with zero records. When I print the report, any report with zero records will not print. Is there a way to get the reports with zero records to print like in the print preview? That way when I give the report to someone it will so that there is no record that met the search criteria.

Thank you for any assistance. Greg
 

MarkK

bit cruncher
Local time
Today, 11:26
Joined
Mar 17, 2004
Messages
8,178
What I have done in this case in the past is check when the report opens how many records it will have. If zero, change the record source to something like ...
Code:
SELECT TOP 1 * FROM tYourSourceTable
... which definitely selects a single record, hide the detail section of the report ...
Code:
Me.Detail.Visible = False
... and change the control source of any summary controls to zero ...
Code:
Me.tbSubTotal.ControlSource = "=0"
Me.tbTaxTotal.ControlSource = "=0"
Me.tbTotal.ControlSource = "=0"
... so the subform appears and shows no records and all zero summaries in the now visible header and footer sections.
Cheers,
Mark
 

glgaunt

New member
Local time
Today, 12:26
Joined
May 17, 2011
Messages
2
Sorry I forgot to mention that this database is accessed by others. So I need the code to be automatic. The other users have no access programming ability.
 

MarkK

bit cruncher
Local time
Today, 11:26
Joined
Mar 17, 2004
Messages
8,178
What I propose here is a completely programmatic solution and does not require any interaction from the user. When I say, "check when the report opens how many records it will have," for instance, I mean to do so in code.
Cheers,
Mark
 

Users who are viewing this thread

Top Bottom