Results 1 to 5 of 5
  1. #1
    GinaFlan is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Location
    Texas
    Posts
    68

    My Outputto button need to add code if they hit cancel instead of ok a runtime error appears


    [Private Sub CmdReport_Click()
    Select Case Me.ComboSummary
    Case "Child Nutrition"
    DoCmd.OutputTo acOutputReport, "Child Nutrition Monthly Report", "", "", False, "", 0
    End Select]


    Run-time error '2501 The output to action was canceled (it's not a big deal but there has to other cancel options)

    Click image for larger version. 

Name:	Create Report.PNG 
Views:	10 
Size:	69.4 KB 
ID:	18481

  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,930
    Options:

    1. error handler code

    2. create your own popup for selecting file format - assign user choice to a variable and use that variable in the OutputTo command
    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
    GinaFlan is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Location
    Texas
    Posts
    68
    I put acformatPDF

    Where would I put error handler code? This will be my first error handler

    This is under my command button click

    [Select Case Me.ComboSummary
    Case "Comptroller"
    DoCmd.OutputTo acOutputReport, "Comptroller September Report", acFormatPDF, "", False, "", 0
    End Select]

  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,930
    If you specify the output file format, error handler should not be needed.

    Here is an article for review http://allenbrowne.com/ser-23a.html
    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
    GinaFlan is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2014
    Location
    Texas
    Posts
    68
    Right ok thank you

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

Similar Threads

  1. Replies: 2
    Last Post: 10-15-2014, 04:23 AM
  2. Replies: 4
    Last Post: 12-30-2013, 05:51 PM
  3. Replies: 0
    Last Post: 03-11-2012, 09:19 AM
  4. RunTime Error 3075, code for search button
    By jacie in forum Programming
    Replies: 1
    Last Post: 04-15-2011, 05:23 AM
  5. Runtime error in preventing duplicates code
    By emilyrogers in forum Access
    Replies: 10
    Last Post: 10-07-2010, 08:14 AM

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