VanIsleMan
Technical User
Well, you'd think this would be easy, but I'm having great difficulty with it. All I want to do is close a report if the recordset is empty. The recordset is built in the report using code. If there are no records in the recordset, control is passed to a MsgBox, like so...
If intPtVisits = 0 Then
MsgBox "blah blah blah", vbInformation, "Information"
GoTo errHandlerClose
Else
blah blah blah
End If
As you can see, at a certain point, I pass control to error handling (errHandlerClose).
errHandlerClose:
rec.Close
DoCmd.CancelEvent
DoCmd.Close
At this point, I just want to close the recordset, cancel the event, and close the report (ie - prevent a blank report from showing on the screen). However, I keep getting error 2585 - this action can't be carried out while processing a form or report event.
What am I doing wrong??
Lex
If intPtVisits = 0 Then
MsgBox "blah blah blah", vbInformation, "Information"
GoTo errHandlerClose
Else
blah blah blah
End If
As you can see, at a certain point, I pass control to error handling (errHandlerClose).
errHandlerClose:
rec.Close
DoCmd.CancelEvent
DoCmd.Close
At this point, I just want to close the recordset, cancel the event, and close the report (ie - prevent a blank report from showing on the screen). However, I keep getting error 2585 - this action can't be carried out while processing a form or report event.
What am I doing wrong??
Lex