F
Frank
BlankI have a form with a command button on it. The button opens a report.
What I want to do is this:
If the report has no records in it, I want a pop up message to display "This
report has no records." Then automatically close after the OK button on the
message box is clicked.
I created the following code and placed in the events property of the
commands button to process the above action>
On Error GoTo ErrorHandler
Dim stDocName As String
stDocName = "My Report"
OpenReport stDocName, acPreview
ExitHere:
Exit Sub
ErrorHandler:
If Err.Number = 2501 Then
MsgBox "No records found."
True
Else
MsgBox Err.Description, , "Error# " & Err.Number
End If
Resume ExitHere
End sub
When running the above, the report opens but nothing else happens.
How do I fix this?
Any assistance is deeply appreciated.
What I want to do is this:
If the report has no records in it, I want a pop up message to display "This
report has no records." Then automatically close after the OK button on the
message box is clicked.
I created the following code and placed in the events property of the
commands button to process the above action>
On Error GoTo ErrorHandler
Dim stDocName As String
stDocName = "My Report"
OpenReport stDocName, acPreview
ExitHere:
Exit Sub
ErrorHandler:
If Err.Number = 2501 Then
MsgBox "No records found."
True
Else
MsgBox Err.Description, , "Error# " & Err.Number
End If
Resume ExitHere
End sub
When running the above, the report opens but nothing else happens.
How do I fix this?
Any assistance is deeply appreciated.