OpenReport error handling

Hello.
I have a form with parameters, so the user can enter the start date and end 
date and then click on Preview to run the report. The form has a Preview 
error handling code. If the form is closed without clicking preview, the form 
shuts nicely.

However, I have this report set to run from an Option button on a 
switchboard form, that in itself has a Preview button: I click the option 
button, then click on the switchboard Preview button, the parameter form 
opens (where I could enter the parameter dates and click Preview to run the 
report- but here I don't), I close the parameter form without entering 
anything and get: "Error in procedure cmdPreview_Click, Error 2501: The 
OpenReport action was canceled."

I thought I had trapped this error.
This is the error handling I have on the switchboard:

Private Sub cmdPreview_Click()
On Error GoTo ProcError

        DoCmd.OpenReport Report_Name, acPreview
        
ExitProc:
    Exit Sub
ProcError:
    MsgBox "Error " & Err.Number & ": " & Err.Description, _
          vbCritical, "Error in procedure cmdPreview_Click..."
    Resume ExitProc
        
End Sub

Private Sub Report_Error(DataErr As Integer, Response As Integer)
PrintPreport_Error:
    If Err.Number <> 2501 Then
        GoTo ProcError
    End If

ExitProc:
    Exit Sub
ProcError:
    MsgBox "Error " & Err.Number & ": " & Err.Description, _
          vbCritical, "Error in procedure Report_Error..."
    Resume ExitProc

End Sub

Private Sub Report_NoData(Cancel As Integer)
On Error GoTo ProcError

 MsgBox "No data meets the report criteria.", vbInformation + vbOKOnly, 
"Animals Deceased"
    Cancel = True
    
ExitProc:
    Exit Sub
ProcError:
    MsgBox "Error " & Err.Number & ": " & Err.Description, _
          vbCritical, "Error in procedure Report_NoData..."
    Resume ExitProc
    
End Sub

Obviously, I don't have it quite right. I'd appreciate your help in trapping 
the dreaded 2501.
Thanks!

0
Utf
7/1/2007 2:16:01 AM
access.reports 4434 articles. 0 followers. Follow

2 Replies
1089 Views

Similar Articles

[PageSpeed] 50

Stephanie <Stephanie@discussions.microsoft.com> wrote:

> Hello.
> I have a form with parameters, so the user can enter the start date and end 
> date and then click on Preview to run the report. The form has a Preview 
> error handling code. If the form is closed without clicking preview, the form 
> shuts nicely.
> 
> However, I have this report set to run from an Option button on a 
> switchboard form, that in itself has a Preview button: I click the option 
> button, then click on the switchboard Preview button, the parameter form 
> opens (where I could enter the parameter dates and click Preview to run the 
> report- but here I don't), I close the parameter form without entering 
> anything and get: "Error in procedure cmdPreview_Click, Error 2501: The 
> OpenReport action was canceled."
> 
> I thought I had trapped this error.
> This is the error handling I have on the switchboard:
> 
> Private Sub cmdPreview_Click()
> On Error GoTo ProcError
> 
>         DoCmd.OpenReport Report_Name, acPreview
>         
> ExitProc:
>     Exit Sub
> ProcError:
>     MsgBox "Error " & Err.Number & ": " & Err.Description, _
>           vbCritical, "Error in procedure cmdPreview_Click..."
>     Resume ExitProc
>         
> End Sub
> 
[...]

> 
> Obviously, I don't have it quite right. I'd appreciate your help in trapping 
> the dreaded 2501.
> Thanks!

I think you need to handle the 2501 error as follows:

  Dim lngErr As Long

  On Error Resume Next
  DoCmd.OpenReport Report_Name, acPreview
  lngErr = Err.Number
  On Error GoTo ProcError
  If (lngErr <> 0) And (lngErr <> 2501) Then
     Err.Raise lngErr  ' Or, as an alternative: GoTo ProcError
  End If

You don't need the Report_Error event.

HTH
Matthias Kl�y
-- 
www.kcc.ch
0
Matthias
7/1/2007 2:35:51 AM
Perfect! Thanks for the help!

"Matthias Klaey" wrote:

> Stephanie <Stephanie@discussions.microsoft.com> wrote:
> 
> > Hello.
> > I have a form with parameters, so the user can enter the start date and end 
> > date and then click on Preview to run the report. The form has a Preview 
> > error handling code. If the form is closed without clicking preview, the form 
> > shuts nicely.
> > 
> > However, I have this report set to run from an Option button on a 
> > switchboard form, that in itself has a Preview button: I click the option 
> > button, then click on the switchboard Preview button, the parameter form 
> > opens (where I could enter the parameter dates and click Preview to run the 
> > report- but here I don't), I close the parameter form without entering 
> > anything and get: "Error in procedure cmdPreview_Click, Error 2501: The 
> > OpenReport action was canceled."
> > 
> > I thought I had trapped this error.
> > This is the error handling I have on the switchboard:
> > 
> > Private Sub cmdPreview_Click()
> > On Error GoTo ProcError
> > 
> >         DoCmd.OpenReport Report_Name, acPreview
> >         
> > ExitProc:
> >     Exit Sub
> > ProcError:
> >     MsgBox "Error " & Err.Number & ": " & Err.Description, _
> >           vbCritical, "Error in procedure cmdPreview_Click..."
> >     Resume ExitProc
> >         
> > End Sub
> > 
> [...]
> 
> > 
> > Obviously, I don't have it quite right. I'd appreciate your help in trapping 
> > the dreaded 2501.
> > Thanks!
> 
> I think you need to handle the 2501 error as follows:
> 
>   Dim lngErr As Long
> 
>   On Error Resume Next
>   DoCmd.OpenReport Report_Name, acPreview
>   lngErr = Err.Number
>   On Error GoTo ProcError
>   If (lngErr <> 0) And (lngErr <> 2501) Then
>      Err.Raise lngErr  ' Or, as an alternative: GoTo ProcError
>   End If
> 
> You don't need the Report_Error event.
> 
> HTH
> Matthias Kläy
> -- 
> www.kcc.ch
> 
0
Utf
7/1/2007 2:50:00 AM
Reply:

Similar Artilces:

Error: "The Payment Document Management Setup is missing or damaged".
Hi, When I click Payment Document Setup or Payment Document User Preference in the Purchasing and the sales module then get the eror: "The Payment Document Management Setup is missing or damaged". Thanks. From your other thread Sadique - You are looking at Payment Document Setup and Payment Document User Preference under Purchasing Setup, correct? There is another Payment Document Setup under Setup>Company in the Administration Setup window in V10 or Tools>Setup>Company>Payment Document Setup in V9. This is the Payment Document Setup I was referring to. Give that a...

error message 550?
I get an error message for every e-mail i try to send that says 550 relaying to ... prohibited by administrator .. any suggestions? Sounds like Outlook is not properly authenticating with your mail server or your server account is not correctly configured. Talk to your mail server administrator (or ISP) and see if they can straighten it out. -- Aloha, -Ben- Ben M. Schorr, OneNote-MVP http://home.hawaii.rr.com/schorr **I apologize but I am unable to respond to direct requests for assistance. Please post questions and replies here in the newsgroup. Mahalo! "Larry" <anony...

Error On Report
Hello, We had created a report in visual studio and imported in MS CRM. This has worked fine for a while. Now when we run this report we get the following error: An error has occurred during report processing. (rsProcessingAborted) Query execution failed for data set 'Contraste_Europe_MSCRM'. (rsErrorExecutingCommand) For more information about this error navigate to the report server on the local server machine, or enable remote errors I noticed one thing, when we run this report with a user with domain admin rights, the report works. When we run this report as a normal domai...

MAD Monitoring Thread Error
I've seen several posts refering to the problem I'm seeing, but I have yet to find a solution that fixes my issue and maybe someone could help me out with things. I'm running Exchange 2003 Server on Windows 2003 Server and every five minutes I'm receiving the following error message in the Application event log: The MAD Monitoring thread was unable to read the state of the services, error '0x80041003'. So far, I've tried the following: - re-registered cdowfevt.dll - followed the steps in Q326011 and Q810861 I've looked up the error code I'm r...

Sending email: "unable to complete task". No error message
-- Von ...

Server Error: 441, Error
I keep getting this error on one of my news groups (verizon) microsoft and the others seem ok? Outlook Express could not post your message: Subject '{Subject}', Account:'{news server}' Server {news server}' Protocol: NNTP, Server Response:'441 posting failed [no valid newsgroups in "Newsgroups"], Port 119,Secure (SSL): No, Server Error: 441, Error Number: 0x800CCCA9 Also have renamed the outbox.dbx, Just in case "Bruce F. Leavitt" <brucefl56 at hotmail.com> wrote in message news:O%23nEKBewDHA.2880@tk2msftngp13.phx.gbl... > I keep gett...

HELP
My Application Log gets filled with 9 or 10 of these messages every few minutes. They are all the same except for the folder. The message reads: "Unable to create public folder proxy object for folder "schema-root" in the Active Directory" The other folders it complains about are: views img controls exchweb exchangeV1 microsoft Default OWAScratchPad{...} The thing is, these folders already exist though. I'm running Exchange 2000 on a Windows 2000 Server in Mixed Mode. Any ideas how to get rid of these errors? I'm not an Exchange expert by any stretch of the ...

Installation Error
Proceeding with CRM30_SBS2003R2 instruction, following the above document to the letter, installing with Administrator (Domain Admin credential), the following error showed up about 2/3 of the way: Installing SQL Server Reporting Services Microsoft CRM3.0 Server Setup Publishing CRM reports failed. System.Web.Services.Protocols.SoapException: The Operation you are attempting requires a secure connection (HTTPS). ---> Microsoft.ReportingServices.Diagnostics.Utilities.SecureConnectionRequiredException: The operation you are attempting re quires a secure connection (HTTPS). at Microsoft.R...

Error Number: 0x800CCC0D
Hi, When I open OE, I got this error message: The host 'pop-sever-bigpond.net.au' could not be found. Please verify that you have entered the server name correctly. Account: 'pop-server-bigpond.net.au', Server: 'pop-sever-bigpond.net.au', Protocol: POP3, Port: 110, Secure(SSL): No, Socket Error: 11004, Error Number: 0x800CCC0D. Anybody can explain what does that mean, please? I got Window XP. Thanx The incoming server name in your account is incorrect. Perhaps you meant 'pop-server-bigpond.net.au' rather than 'pop-sever-bigpond.net.au'. -- Jeff S...

outlook error message #37
when i go to start outlook express i get an error message saying ....failed to run vb script dll. can i dload outlook from anywhere and re install it ? thanks in advance Try posting in an Outlook Express group - this group supports Outlook from Microsoft Office. Outlook Express is a part of Internet Explorer. You can also try http://insideoe.tomsterdam.com for assistance with OE. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without ...

WindowsUpdate_00000646 error
Tried to DL 6 updates multiple times with no luck. Help? Security Update for Microsoft Office Excel 2007 (KB973593) Security Update for Microsoft Office Visio Viewer 2007 (KB973709) Security Update for the 2007 Microsoft Office System (KB972581) Security Update for the 2007 Microsoft Office System (KB973704) Security Update for the 2007 Microsoft Office System (KB974234) Update for Microsoft Office Word 2007 (KB974561) Try installing the optional updates first then the other updates should install just fine. I had the same three updates: > Security Update for Microsoft Office ...

DoCmd.OpenReport suddenly failing, macro OpenReport succeeds
This is weird. This database has worked ok for years, now suddenly in some VBA code a DoCmd.OpenReport is failing, the error handler there doesn't get hit, but the macro that called that VBA function gets an Action Failed in RunCode. If I open the report manually it succeeds, if I open it directly from a macro it succeeds. At least a couple of different places this happens. Anyone else seen this? One more thing, it only is a problem on one machine (WinXP SP2), others WinXP SP2 machines are still ok. And if the VBA code does a RunMacro which prints the report that works, but if the ...

Returns Transaction Entry Error
I'm trying to do a Return. Just a plain Return not Return w/Credit. I'm getting the error message: "There are no available quantities for this item or vendor item. Please select a different item or vendor item." The PO has been received but not invoiced. There are quantities on-hand for this item but many have been sold. Why am I getting this error? Thanks. Michelle Michelle, Apparently, the quantity that was received for this item/vendor combination have been sold or otherwise consumed. Do you buy this item from more than one vendor? Could...

Any thoughts? Application error .data not place into memory because of an I/O error
Folks The following problem has been reported twice on two separate systems at one particular client The instruction at 0x7344de72 referenced memory at 004bac40. The required data was not placed into memory because of an I/O error status of 0000000c4 Given that the VB6 exe resides on the server I'm thinking this is a network corrupt packet issue of some sort given the IO error. Or maybe bad RAM. There are a total of three hits for "data not placed into memory because of an I/O error". So this is exceedingly rare. Tony -- Tony Toews, Microsoft Access M...

What is this error?
Hello, A user of mine is getting the following error on several messages from a single sender: Can't open this item. Your Digital ID name cannot be found by the underlying security system. Is this something on my end or does the sender need to give my user a cert of some sort so that he can open this? Any help on how this works is appreciated. The environment is E2K3 with Outlook 2K3. Thanks, Dan You probably want to have an understanding of SMIME and what is required. Here is one site that explains it...http://www.marknoble.com/tutorial/smime/smime.aspx Then check out htt...

TransferSpreadsheet Error #2
I am using the DoCmd.TransferSpreadsheet method in an Access Form to export Data to an Excel workbook. Sometimes the method works, sometimes I get the following error: Error Number: 3310 Error Description: This property is not supported for external data sources or for databases created with a previous version of Microsoft Jet. The table being exported is actually a query, and the database has been created with the current version of Jet (4.0). Can anyone help me with this issue? Thanks, DJ Are there functions on the query? Are any properties set on columns of the queries, like date...

OpenReport error handling
Hello. I have a form with parameters, so the user can enter the start date and end date and then click on Preview to run the report. The form has a Preview error handling code. If the form is closed without clicking preview, the form shuts nicely. However, I have this report set to run from an Option button on a switchboard form, that in itself has a Preview button: I click the option button, then click on the switchboard Preview button, the parameter form opens (where I could enter the parameter dates and click Preview to run the report- but here I don't), I close the parameter fo...

O2010 Language DLL error
Hello, When I recieve excel docs via outlook 2010 I receive the following error when trying to open it up from an email. But once I hit Ok, it opens up the excel 2010 sheet. .. The language DLL 'VBE7INTL.DLL' could not be found. Any suggestions on how to resolve? Thanks in advance. ...

I am getting an error at checkout for CC and Debits
I get this when i swip cards; 05: Must Balance Now This is the message in the approval box for my CC process in the elctronic draft status box. Please help me send email to jbobsnake@hotmail.com or post answer so i can fix this. THX, J This is a multi-part message in MIME format. ------=_NextPart_000_0056_01C863FE.73E09440 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable J, Have you closed your credit card batch recently? Manager | Utilities | = Settle EDC Batch. This must be done nightly for the best rates = otherwise most processors c...

Error -18596
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel Email Client: Exchange I have an end user running 10.5 on her Intel iMac. Her Entourage stopped working, getting the following message.... <br><br>Error <br> HTTP error. The resource is not found. <br><br>Error:-18596 <br><br>Can anyone help me with this? (I've already erased her Office Folder and reinstalled it. Ran Disk Permission) On 2010-01-14 13:25:48 -0500, binkysdad@officeformac.com said: > > Error:-18596 I looked around and found this: http://ww...

Error Message #6
I am getting an error message "Compile Error in hidden module: DistMon" issued by Visual Basic, everytime I open or close MS Excel. Its irritating although Excel is doing fine & perform all the tasks asusual. I also have some macros & frequently use Visual Basic to perfrom simple tasks. do you have any clue? Regards, Murtaza Not sure without a bit more info - if you are able to look at an error report, take a look at that. Also try reading:- http://support.microsoft.com/kb/307410 HTH Andi "Murtaza" <NoEmail@NoEmail> wrote in message news:OIQAaKWJF...

Error 3033
I could not open a database I created. When I double clicked the program, I got "You don't have necessary permission to use this object ..." and after I clicked Help button, I learned that I have an error code of 3033. How did this happen? I figure that this may have something to do with the workgroup but I did not create any workgroup other than the default one and I did not change it. Any help or suggestion is greatly appreciated. Tommy, ...

Error 0x800CCC0F
Dear all, Today many users on our site received the message similar to the below. Task 'pop.xxxx.com.hk - Receiving' reported error (0x800CCC0F) : 'The connection to the server was interrupted. If this problem continues, contact your server administrator or Internet service provider (ISP).' We connect to our ISP POP server (MS Exchange 2007) to download email to our outlook/outlook express client. When we check for new email, sometimes we can successfully download the mails and sometimes we get the above message. Our ISP reported no error on their POP serve...

OWA 2k3 password change error in IIS6
Enabled password change button in OWA but when I try to change the password I receive one of two errors: Access denied or Internet Service Manager for Internet Information Server 6.0 Error number: -2147023570 I'm running Exchange 2k3 on a W2k3 server. I believe this has more to do with configuring IIS6 than Exchange, since a similar setup (Exchange 2k3 on W2k) is working. I'm stumped. Anyone run across this? Steve Dziatkowiec. MCSA We had an identical problem here. Try to force "change password" from Active Directory, and see if it allows you to ...

Help
When opening many (but not all) web pages, I keep getting the following error: Line: 2 Char: 1 Error: Syntax Error Code:0 This just started happening yesterday, and I can't think of anything I did that could have altered IE other than Windows automatic updates. What does this mean and how do I fix it? Thanks ...