N
Nick hfrupn
I have a problem with a report that if there is no data is returned a message
appears to say No Cards to Print. Press the OK button to close the report and
return to the Main Switchboard. Then the following error comes up;
Microsoft Visual Basic
Run-time ‘error ‘: 2501
The OpenReport action was cancelled
End or Debug
When I press the Debug the following code below is displayed with this line
is highlighted DoCmd.OpenReport "Cards Not Printed", acViewPreview.
I think that as this code has a line referring to the error message 2501 so
that it should not appear. If this is correct then can anyone explain what is
happening, as I don’t understand?
Is it possible to stop this message appearing?
Thanks for any assistance.
Nick
Public Function pfPreviewCards()
On Error GoTo ErrorBit
If pfSetCardColour() Then
pbPrint = False
DoCmd.OpenReport "Cards Not Printed", acViewPreview
Else
MsgBox "There was a Problem with Previewing the Cards", vbCritical,
"Previewing Membership Cards"
End If
ExitBit:
Exit Function
ErrorBit:
If Err = 2501 Then Resume Next Else GoTo ExitBit
Dim strError As String
strError = "Error Information..." & vbCrLf
strError = strError & "Error#: " & Err.Number & vbCrLf
strError = strError & "Description: " & Err.Description
MsgBox strError, vbCritical + vbOKOnly, "Function: pfPreviewCards()"
Resume ExitBit
End Function
appears to say No Cards to Print. Press the OK button to close the report and
return to the Main Switchboard. Then the following error comes up;
Microsoft Visual Basic
Run-time ‘error ‘: 2501
The OpenReport action was cancelled
End or Debug
When I press the Debug the following code below is displayed with this line
is highlighted DoCmd.OpenReport "Cards Not Printed", acViewPreview.
I think that as this code has a line referring to the error message 2501 so
that it should not appear. If this is correct then can anyone explain what is
happening, as I don’t understand?
Is it possible to stop this message appearing?
Thanks for any assistance.
Nick
Public Function pfPreviewCards()
On Error GoTo ErrorBit
If pfSetCardColour() Then
pbPrint = False
DoCmd.OpenReport "Cards Not Printed", acViewPreview
Else
MsgBox "There was a Problem with Previewing the Cards", vbCritical,
"Previewing Membership Cards"
End If
ExitBit:
Exit Function
ErrorBit:
If Err = 2501 Then Resume Next Else GoTo ExitBit
Dim strError As String
strError = "Error Information..." & vbCrLf
strError = strError & "Error#: " & Err.Number & vbCrLf
strError = strError & "Description: " & Err.Description
MsgBox strError, vbCritical + vbOKOnly, "Function: pfPreviewCards()"
Resume ExitBit
End Function