Copy the following code into the form's code module.
Neil Squires
-----------------------
Dim Report_Activated As Boolean
' Purpose : Sets the reports Restore/Maximize property. Also
flags the report
' as being activated.
Private Sub Report_Activate()
DoCmd.Maximize
Report_Activated = True
End Sub
' Purpose : Once the report is activated, the routine notifies
the user if there
' is no data in the report. If so, the report open is
cancelled.
Private Sub Report_NoData(Cancel As Integer)
If Report_Activated = True Then
Call errCustom("This Report Contains No Data")
Cancel = True
End If
End Sub
' Purpose : Report_Activated is set to false, as the
Report_NoData fires twice.
' if it fires before the Report_Activate routine, a
runtime error is
' generated. This process eliminates the runtime
error.
Private Sub Report_Open(Cancel As Integer)
Report_Activated = False
End Sub
-------------------------------
_____
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Marty
Sent: Wednesday, June 06, 2007 1:24 PM
To: [email protected]
Subject: [ms_access] Another form question
I want to open a form with filtered data. If the filtered data
contains no results I would rather the form not open and display a
message that nor records were found. How do I do that?
[Non-text portions of this message have been removed]