printing error handling issue? (when clicking cancel get 2501 error)

I have a report that when it is closed the

DoCmd RunCommand acCmdPrint    occurs ... but of course if the user clicks 
cancel, it gives me

a 2501 error.

How & where do I put code to surpress this error. I would just the close 
even to run the
DoCmd RunCommand acCmdPrint and if cancel is selected just continue to close 
the report?

TIA,
_Bigred


0
_Bigred
9/22/2007 5:02:42 AM
access.reports 4434 articles. 0 followers. Follow

3 Replies
1394 Views

Similar Articles

[PageSpeed] 14

I understand that I have to do this, I actually don't understand HOW to do 
it, and where to put code to accomplish this??

1) What code do I use?
2) Where do I put the code?

Thanks,
_Bigred



"Duane Hookom" <duanehookom@NO_SPAMhotmail.com> wrote in message 
news:2EC7E384-C82E-459F-841A-49BB994BCBA9@microsoft.com...
> You need to trap for the err 2501 in the code that opens the report.
>
> -- 
> Duane Hookom
> Microsoft Access MVP
>
>
> "_Bigred" wrote:
>
>> I have a report that when it is closed the
>>
>> DoCmd RunCommand acCmdPrint    occurs ... but of course if the user 
>> clicks
>> cancel, it gives me
>>
>> a 2501 error.
>>
>> How & where do I put code to surpress this error. I would just the close
>> even to run the
>> DoCmd RunCommand acCmdPrint and if cancel is selected just continue to 
>> close
>> the report?
>>
>> TIA,
>> _Bigred
>>
>>
>> 


0
_Bigred
9/23/2007 6:18:25 AM
_Bigred wrote:
> I understand that I have to do this, I actually don't understand HOW
> to do it, and where to put code to accomplish this??
>
> 1) What code do I use?
> 2) Where do I put the code?

Answer for 2) first.  You will modify the code you have now so that is WHERE the 
code goes.

Answer for 1)...

(line that starts your event code)

On Error GoTo ErrHandler

(your existing code)

Egress:
Exit Sub

ErrHandler:
Select Case Err.Number
    Case 2501
        'ignore
    Case Else
        MsgBox Err.Description 'for other errors
End Select
Resume Egress

End Sub

In the example above "ErrHandler" and "Egress" are just line labels so you can 
use whatever you want there (those are just the labels I always use).

The idea is that when there are no errors you hit the Exit Sub line so the code 
in the Error Handler is not run.  When there is an error your code will jump 
down to the ErrHandler label and then execute the code it finds there.  The 
Resume line at the end sends the code back up to your code exit point (it is 
better to always have the code terminate at the same spot rather than just 
letting it fall through to your End Sub line).

-- 
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com 


0
Rick
9/23/2007 12:22:09 PM
Thanks much Rick, I'll try that solution out and post back results.

Thank You for your time & help,
_Bigred



"Rick Brandt" <rickbrandt2@hotmail.com> wrote in message 
news:RTsJi.1319$6p6.1211@newssvr25.news.prodigy.net...
> _Bigred wrote:
>> I understand that I have to do this, I actually don't understand HOW
>> to do it, and where to put code to accomplish this??
>>
>> 1) What code do I use?
>> 2) Where do I put the code?
>
> Answer for 2) first.  You will modify the code you have now so that is 
> WHERE the code goes.
>
> Answer for 1)...
>
> (line that starts your event code)
>
> On Error GoTo ErrHandler
>
> (your existing code)
>
> Egress:
> Exit Sub
>
> ErrHandler:
> Select Case Err.Number
>    Case 2501
>        'ignore
>    Case Else
>        MsgBox Err.Description 'for other errors
> End Select
> Resume Egress
>
> End Sub
>
> In the example above "ErrHandler" and "Egress" are just line labels so you 
> can use whatever you want there (those are just the labels I always use).
>
> The idea is that when there are no errors you hit the Exit Sub line so the 
> code in the Error Handler is not run.  When there is an error your code 
> will jump down to the ErrHandler label and then execute the code it finds 
> there.  The Resume line at the end sends the code back up to your code 
> exit point (it is better to always have the code terminate at the same 
> spot rather than just letting it fall through to your End Sub line).
>
> -- 
> Rick Brandt, Microsoft Access MVP
> Email (as appropriate) to...
> RBrandt   at   Hunter   dot   com
> 


0
_Bigred
9/23/2007 12:54:33 PM
Reply:

Similar Artilces:

MAPI Error #4
Hello when I try to export a received e-mail I receive the error <Mapi inizialization> Please what can I do to avoid this error ? Thank you very much. Francesco try posting this to the Outlook Express newsgroups. --=20 Peter Please Reply to Newsgroup for the benefit of others Requests for assistance by email can not and will not be acknowledged. "Francesco" <depo72@libero.it> wrote in message = news:VGQlh.95198$uv5.1216034@twister1.libero.it... > Hello > when I try to export a received e-mail > I receive the error <M...

Issues with special characters after Exchange 2003 migration
Hello all, We did a swing upgrade from Exchange 2000 to Exchange 2003 recently. We still have some old mailboxes sitting on our Exchange 2000 box and is not decommisioned yet. Whenever I send a message from my outlook with special characters like ",'? it turns out to ba funny symbol and it's happening for everybody using MAPI client "Outlook". This happens only with Outlook. Is there any setting to preven this? Thanks ...

Public Folder replication error
when I click on a public folder and goto properties in ESM I get this error The operation Failed because of an HTTP error 501 (Not Implemented) ID no: c1020af6 now I followed this http://support.microsoft.com/default.aspx?scid=kb;en- us;839744 and it does not fix the problem need some help so I Can remove my first exchange Server from the site ...

Listbox won't display contents until I click on it
I have a form with a list box. Everything works fine except the contents of the listbox don't display until I click on the listbox. Thoughts? Does the list have it's own rowsource? How do you set the rowsource? When the listbox is bound to a rowsource it should display it's data as soon as you open the form. Any other settings that might prevent it from being filled... -- Maurice Ausum "SteveL5231" wrote: > I have a form with a list box. Everything works fine except the contents of > the listbox don't display until I click on the listb...

security key not found error?
I have a customer running 2 lanes and 3 back offices. The dongle is installed on the first POS station. We are getting a "Security device not found error" on all the back office machines when they run manager. The POS station is booted up first and POS app is turned on before anything else. I know this isnt causing any problems but has anyone ever encountered this? It sounds like all of the back office machines are identifying themselves as register 1. In SO Manager, create a new register (Database/Registers/Register List) for each of the back office machines. On eac...

Can anyone give me insight about this error?
Hi all, When I tried to upgrade exch2000 to exch2003, it failed and I got this error: Event Type: Error Event Source: MSExchangeSetup Event Category: Microsoft Exchange Setup Event ID: 1002 Date: 7/14/2006 Time: 1:21:32 PM User: N/A Computer: MARS Description: Exchange Server component Microsoft Exchange Messaging and Collaboration Services failed. Error: 0xc0070574 - Logon Failure: The target account name is incorrect. For more information, click http://www.microsoft.com/contentredirect.asp. Can anyone give me insight about this error? I'm going crazy now as I did domainprep...

Finetune formula to get currency format?
I've managed to put together two different formulas from two different sources and it seems to be working okay except in terms of the format of the numbers. The formula is this: =IF(G2="?",TEXT(G2,"$0")&" ttl unknown",G2*I2) The "$0" in there is a remnant from the original. I don't know what to do with it so I've left it in. The purpose of this formula is to deal with situations where a list price is unknown and a user puts a question mark in G2. This formula goes into the totals column but there is no total known so th...

Excel error #3
When I try to format a cell in a workbook, I am getting an error "To many cell formats." Does anyone know how to fix this error? Thanks i advance for your help -- jeans ----------------------------------------------------------------------- jeanst's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3781 View this thread: http://www.excelforum.com/showthread.php?threadid=57377 Read and heed this KB article. http://support.microsoft.com/default.aspx?scid=kb;en-us;213904 Gord Dibben MS Excel MVP On Mon, 21 Aug 2006 10:34:23 -0400, jeanst <jeanst.2...

Error in downloading statement to Money 2004
I am no longer able to download statements from my bank. I receive the following message: The Managed Software Installer failed to install the program associated with this file. Contact your system administrator. Then when I click ok the following error appears: Access to the specified device, path, or file is denied. I am a newbie wih Money 2004. I used the 98 version with no problems until my bank no longer supported that version. Can someone help me? Thanks in advance. In microsoft.public.money, Dawn wrote: >I am no longer able to download statements from my bank. I >recei...

When I search on my name "Meenie" I don't get 2010 posts
Why don't 2010 posts come up in search? I know this isn't actually about excel - but excel is what I usually post about and I don't see a place to ask about the way this board works. :) But when I enter my name "meenie" into the search box it shows posts I've made and posts I've answers from 2006 through 2009, but nothing from 2010. any idea why that is? There are so many questions asked here every day (every hour!) it can be hard to find a post made before this day. Thanks :) -- Ytwater Hi Meenie I see 17 post for this Year.Check thid site; ...

Error converting leads to contacts
HI We are running CRM V1.2. It is a fresh installation and currently has no contact data. We can successfully create a lead; and we can successfully create a contact. However when we attempt to convert the lead to a contact an error dialog pops up. It says "An Error has occurred. Please contact your system administrator" Looking at the IIS logs I can see the following lines; GET /SFA/Leads/Dialogs/conv_lead.aspx - 302 GET /_common/error/errorhandler.aspx errNum=Not%20Applicable 200 Would anybody be able to shed some light? Thanks What's the error in the windows event l...

VPN issues
Recently i have installed Windows Server 2008 on my server in my basement and deployed it as a file server and a VPN so ica naccess my Files remtely since im in the military and travel alot. Heres my issue: From home i can do the following: Access all shares through my networking VPN inside the network to the server VPN to the Routers IP (my server is set to have ports forwarded to allow for VPN) Stream Video Access files Remotely (IE outside my home network) I can setup the VPN so it shows that im connected and the ipconfig in command prompt shows the link is active, howev...

Print MFC Dialog
Hi, I have a MFC dialog application. The main dialog has a number of controls on it including an ADO data grid and also a bitmap. I would like to print the whole dialog out. I obviously cant use the CView printing options as it is a dialog application. I'd appreciate any suggesstions as to how i can achieve this, Thanks In Advance Macca I would suggest paying visit to codeguru forum and search articles and posts. http://www.codeguru.com/forum/ and http://www.codeguru.com "Macca" wrote: > Hi, > > I have a MFC dialog application. The main dialog has a number of...

errors
Hello, I have a coworker who is having these errors in Publisher: Due to low memory or use of a floppy other than the one you started with, Publisher has had to rename your publication C:\PUB242.TMP. To resume, close all programs, including Publisher, then restart Publisher and open the file. You may then rename the application. and this error: MSPUB.EXE - Application Error The instruction at "0x600193f0" referenced memory at "0x0000000". The memory could not be "read". Click on OK to terminate the program Click on CANCEL to debug the program Sometime...

OWA-"!an unknown error has happened"
In Outlook Web Access, when I try to reply to or forward an e-mail message, I get an error message with a red explanation point in front of it saying "!an unknown error happened." Anyone know what this is? It's also happening at a time when my signal from my cable modem connection is not very strong. Could this be causing it? Try asking this in an Exchange group as OWA is a function of Exchange, not Outlook. microsoft.public.exchange.admin is a good place to start. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to ...

QSIMPORT ~ Error 00003021
Hello -- When attempting to load item data using the import utility I'm consistantly getting these 3021 errors for no apparent reason. They'll usually be on the first 10 nines of data (imported from a .csv file) but sometimes it'll vary -- even using the same import file. I know the data is good because I tested using a file in which I appended the first ten lines (that had the error) at the end of the import file and it took everything fine...any ideas what this error message means and why it's behavior seems inconsistant? Regards, -=Rich=- ...

Is there a way you can get Excel to change an image in a cell
K. I will try and explain this the best I can. I am creating a database based on ships. I have around 50 thumbsized images and I have resized a cell to fit these images in the main page that gives information about each ship. I need this cell to be able to change the image each time the name of the ship changes. I can't store these images on my HD and link to them as other people useing the database would have to have the same images as well. I would like to paste all the images into a seperate sheet in the workbook. The only way I can think of doing this would be to lock an image to a...

Handling messages posted during a shutdown process
Ok, still working on a fun little multi-threaded SDI program I've been trying to get up and running, and for the most part everything is working fine. I'm currently working on the shutdown process, but an interesting catch happened: Upon shutting down the collector / processing threads, they post additional messages to the main window (in this case a CFrameWnd). Some of these messages contain information that needs to be dealt with before shutting down, so my solution was to have a boolean that determines whether or not it's actually safe to shutdown, as below: void CMainFrame:...

CTestDoc* GetDocument() errors in view class
I am getting these errors in my view header: error C2143: syntax error : missing ';' before '*' error C2501: CTestDoc: missing storage-class or type specifiers error C2501: 'GetDocument' : missing storage-class or type specifiers for this statement: CTestDoc* GetDocument(); Currently, I am using class CTestDoc; earlier in the file to satisfy the need. Can I get some help on this? Much appreciated! At the top of your .cpp file put: #include "TestDoc.h" Or whatever the name of your file is. KS "Steve Russell" <srussell@innernet.net&g...

here is error message ..office wont launch..please help
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel whats going on...this just started today.....no office apps will launch.. here is report..sorry its lengthy: Microsoft Error Reporting log version: 2.0 Error Signature: Exception: EXC_BAD_ACCESS Date/Time: 2009-06-28 19:22:05 -0700 Application Name: Microsoft Word Application Bundle ID: com.microsoft.Word Application Signature: MSWD Application Version: 12.1.5.081119 Crashed Module Name: OSServices Crashed Module Version: unknown Crashed Module Offset: 0x00021e2c Blame Module Name: OSServices Blame Module Version: unk...

Outlook express blank error
When I sent a mail with attachment I receive a blank error, and the message remains in outbox. The mail is sent but is still in outbox. Any ideea?? "Clau" <clau@edil.ro> wrote in message news:eoaV8R7yEHA.1412@tk2msftngp13.phx.gbl... > When I sent a mail with attachment I receive a blank error, and the > message remains in outbox. The mail is sent but is still in outbox. Any > ideea?? > Yeah, post to a newsgroup that deals with Outlook Express. This newsgroup is for Outlook. Clau <clau@edil.ro> wrote: > When I sent a mail with attachment I re...

'Type Mismatch' Error- PLEASE HELP
we have a macro setup to update data info by uploading an excel spreadhseet in the access database. However when i try this, i get a 'type mismatch' error. the excel spreadsheet is labelled correctly. below is the line that has a break ( and highlightes in yellow): rptdate = CInt(Mid(FileList, 43, 2)) & "/" & CInt(Mid(FileList, 45, 2)) & "/" & CInt(Mid(FileList, 47, 2)) any suggestions? thanks in advance!!! If rptdate is a Date/Time fields, what you've created isn't a date. You could use the CDate function or wrap it arou...

How do I cancel a tutorial? It's affecting my incoming mail.
Diana wrote: > Nothing PLEASE write your question in the body of the post and NOT just the subject Have a look here: http://dts-l.org/goodpost.htm What "tutorial" where? -- Registered Linux User no 240308 to email me invalidate the invalid! ...

3-D Graphs Issue
Hi, everyone. I was wondering if there is a way to minimize the distance between the left wall and the vertical Y-axis in an Excel 3-D graph. It looks like the options are quiet limited. I'm on Excel 2000. Any ideas? Thank you in advance and have a great week-end. Anya, not sure if this is what you want, but here goes: Right-click the walls and select 3-D View from the shortcut menu. Use the arrow buttons to adjust the elevation and rotation. Or enter values in the Elevation and Rotation fields. The wireframe will give you an idea of the result. -- DDM "DDM's Microsoft Off...

Only ID numbers are printing
I have Access 2007. I have two tables Contact List and Asset List. I am trying to print two reports. I want to print the owner and the companies they lease to from the Asset List. Also from the Contact List I would like to list the Companies and their Lessors. When I try to do the asset list one it only gives me id numbers. What am I doing wrong? -- helpme This is a typical issue when you use lookup fields in tables. My advice is: don't use them. Your report's record source must contain the field that actually stores the value you would like to display in the r...