Full Version: Error Handling If More Than One Error
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
Adnila
I have a button on a form to open a report and error handling (connected to there being no data in the report if I remember rightly) as follows:

ErrHandler:
Select Case Err.Number
Case 2501
Resume Next
Case Else
MsgBox “Error Number “& Err.Number & vbCrLf & “Error Description: “ &
Err.Description, vbOKOnly + vbExclamation, “Error”
Resume ErrHandlerExit
End Select
End Sub


If there is no data for the report a message pops up advising this.

I have now added the following to the open report code:

DoCmd.Maximise
DoCmd.RunCommand ac CmdFitToWindow

I still get the message advising there is no data to create the report but now when I click on OK I get the following message:

Error 2046
Error description: The command or action 'FitToWindow' isn't available now.

How do I add this error to the other one so I don't get this message?
Alan_G
Hi

Maybe try this

CODE
Case 2046, 2501
Adnila
That worked a treat, thank you very much.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.