Results 1 to 5 of 5
  1. #1
    brharrii's Avatar
    brharrii is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Seattle, WA
    Posts
    63

    On cancel output, access displays runtime error advising that the output was canceled

    I am using a button on a form to output a report. The code looks like this:




    Code:
    Private Sub cmdSave_Click()
        DoCmd.OutputTo acOutputReport, "rptEmailREport", acFormatPDF, , False, "", 0
        
    End Sub

    The code seems to work, it just does this obnoxious thing where if the user desides after pressing the button that they no longer wish to output the file and they push cancel instead of ok from the file dialog box, access displays a runtime error advising the user that the output was canceled. I'd like to supress this error as I don't see it as being useful to the end user. can anyone advise on how best to do that?

    Thanks!

    Bruce

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Maybe trap the error with an error handler. Does the message show an error number?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    brharrii's Avatar
    brharrii is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Seattle, WA
    Posts
    63
    ah ok, how can I do that? The error message it shows is:

    Run-time error '2501':

    The OutputTo Action was Canceled

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Here is MS article about error handler http://msdn.microsoft.com/en-us/libr...ffice.12).aspx
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    brharrii's Avatar
    brharrii is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Seattle, WA
    Posts
    63
    Thank you very much

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 08-15-2013, 10:10 AM
  2. runtime error 2501 openform action was canceled
    By rumenrs in forum Programming
    Replies: 2
    Last Post: 04-11-2013, 04:29 AM
  3. Access Export vs Output
    By buckwheat in forum Access
    Replies: 15
    Last Post: 02-01-2013, 03:58 PM
  4. MS Access to Excel Output
    By rjbautista20 in forum Programming
    Replies: 7
    Last Post: 02-22-2012, 07:23 PM
  5. Querry IIf Output Format (Access 2003)
    By Bruce in forum Access
    Replies: 2
    Last Post: 12-03-2009, 06:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums