UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Error Handling If More Than One Error, Office 2003    
 
   
Adnila
post Jan 16 2012, 03:10 PM
Post #1

UtterAccess Enthusiast
Posts: 80



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?
Go to the top of the page
 
+
Alan_G
post Jan 16 2012, 03:26 PM
Post #2

Utterly Yorkshire and Forum/Wiki Editor
Posts: 15,884
From: Devon UK



Hi

Maybe try this

CODE
Case 2046, 2501
Go to the top of the page
 
+
Adnila
post Jan 18 2012, 02:25 PM
Post #3

UtterAccess Enthusiast
Posts: 80



That worked a treat, thank you very much.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 11:55 AM