I just read your first post through again and realized that what you are wanting is that your Report should say '07/25/2012 No Data Available' - or something like that when there is no data for the report - right?
There is an 'On No Data' Event for every Report - I was not aware of that till I googled it [because I write reports in other report-creation software [Cognos, Crystal Reports . . .] that have that feature - and while it looks like Access handles this differently - I haven't thoroughly researched it.
But - with what I have read - it might be easier than I thought.
There may be a more elegant way of doing this - but this is easy & will work.
1.
Create a Query like I showed you earlier:
Code:
Select Date() as ReportDate, 0 As NumberOfRecords;
and name it 'NoData' [for instance].
2.
a. Make a Copy of your existing Report and name it something like - YourReportName_NoData.
b. You will use this report [minus the data fields] as a 'template' for the 'NoData' version of the report.
c. Delete all the Fields from the Detail Section of the Report.
d. Go to Property Sheet & Make sure that 'Selection Type:' . . . is 'Report'.
e. Click on the Data Tab & change the Record Source to 'NoData' - [to connect the report to the NoData query you created in Step 1].
f. Click on the large 'Add Existing Fields' button towards the top of the screen - this will bring up the two fields from the NoData query.
g. Add those two fields to your report.
h. You'll have to decide how you want the Date and the NumberOfRecords fields to be displayed - and whether you want to keep the column headers from the original report or not . . .
3. Open the 'YourReportName' [your existing report] report in Design View.
4. Go to Property Sheet [make sure that the Property Sheet says Selection Type: Report] -> Event -> On No Data.
5. Click on the [...] to the right of the On No Data row and select Code Builder.
6. In the Code Window that opens - paste in:
Code:
DoCmd.Close acReport, "Courses"
DoCmd.OpenReport "Table3", acViewPreview
Your VBA screen should look like this:
Code:
Private Sub Report_NoData(Cancel As Integer)
DoCmd.Close acReport, "YourReportName"
DoCmd.OpenReport "YourReportName_NoData", acViewPreview
End Sub
Now - when you run 'YourReportName' - if there is no data, the VBA will close 'YourReportName' and open 'YourReportName_NoData'.
I hope this helps!