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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying a Text Box On No Data

Status
Not open for further replies.

cantona

Technical User
May 20, 2001
121
GB
I have a report that may contain no data. I would like to insert a text box into the details section that would display "No Data Found For Query" when no records are returned. Whats the best way of doing this?
 
The report actually has an EVENT called "on no data". Here you can write a quick piece of code like

msgbox("no data found, closing report")
docmd.close

 
Thanks for that. Is there a way of getting a message to appear on the report itself, rather than via a msgbox?
 
You can try add a text box in the report header section (there will be no detail section) with a control source like:
=IIf([HasData],Null,"No Data to Display")

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]
 
I've added a label lblNoDataMessage, "No data to display", then set the form properties OnNoData, =[lblNoDataMessage].[Visible]=True
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top