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?