Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print suitable message when subreport is empty?

Status
Not open for further replies.

mikeg8

Technical User
Sep 11, 2003
32
GB
I have a main report with 7 subreports. Some of these subreports may be empty. When one is empty, nothing prints at all for that subreport. I want to print an empty subreport (title, header and so on) and also a message to say that it is intentionally empty. I need the message on the report, not the screen!
I'm still pretty new so assume I know nothing and please go s l o w l y!

Thanks in advance

Mike
 
You can add a text box with a control source like:
=IIf(subreportA.Report.HasData, Null, "No data in subreport A")
You can't display the headings from a subreport that doesn't return records. You would need to use text boxes like the previous with the HasData property.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
dhookum
Thanks for that, I shall try it. Can I 'fool' Access into thinking that it has found some data, so that it will print the header and so on, and then the No Data message?
Mike
 
Considering "I'm still pretty new so assume I know nothing and please go s l o w l y!" I can't imagine a method that would work. If I didn't want to take the time to duplicate the headings in the main report, I would consider making the subreport recordsource into a union query that would always return at least one row. I would then try to add code to cancel the printing of the "unioned" record.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Sometimes I have this problem. I put a period in a blank field to force the headings to print. Yes, the period shows up on the report. But it is not too noticeable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top