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

Report with NO data

Status
Not open for further replies.
Apr 22, 2003
14
US
I would like to create a message box that says "I'm sorry there is no data for that report" and not open up a blank report like what I'm getting now. Is there an if statement I can create somewhere to not open the report?
 
What I'm doing is this...

Before opening a report, I check the RecordCount of the report source. If the count is < 1, I don't open the report. Otherwise, I open the report and let the users have at it.

I hope this helps.

--
Jonathan
 
Sub OpenReport()

'Use ADO to connect to the data Table(s)

If rec.EOF And rec.BOF Then 'rec = recordset

MsgBox &quot;I'm sorry there is no data for that report&quot;, vbOKOnly, &quot;No data...&quot;
Exit Sub
End If

End Sub

'the &quot;exit sub&quot; will simply end the OpenReport subroutine
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top