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

Getting a query to display None if no records are found 1

Status
Not open for further replies.

stotzc001

Technical User
Mar 27, 2003
30
US
I have a query that totals data on a daily basis, but on days when do data is calculated, the query shows no results which leaves blanks in my related report. Is there anyway to make the query show "0" or "No Events For Today" is it returns no results?
 
Your report has the NoData event:

Private Sub Report_NoData(Cancel As Integer)
Beep
MsgBox "No data on your selection"
Cancel = True
End Sub

Don't forget to trap error 2501 in the procedure that attepts to open the report...


If you however want to open the report to see whatever text,
create an invisible textbox in the report header.

Private Sub Report_NoData(Cancel As Integer)
Me.Section(0).Visible = False 'detail section
'...whatever sections (except report header)
Me("TextBoxName").Visible = True
End Sub


Good luck

[pipe]
Daniel Vlas
Systems Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top