Results 1 to 8 of 8
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919

    Suppress "Error" message following "Cancel = True"

    I have a report with a "no data" event that issues a "friendly" message to the user and then issues a "Cancel = True" to terminate the report. However, I then get an error notification to the effect that the action was cancelled. How do I suppress that notification?

    Thanks,
    Bill

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Are you exporting a report as PDF? If yes, in the docmd that opens report you will need to do an error trap.

  3. #3
    Xipooo's Avatar
    Xipooo is offline Sr. Database Developer
    Windows 8 Access 2013
    Join Date
    Jan 2014
    Location
    Arizona
    Posts
    332
    docmd.warnings false to turn off
    docmd.warnings true to turn on

  4. #4
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    I still get the 2501

    Code:
    Private Sub cmdPrtMem_Click()
    DoCmd.SetWarnings False
    DoCmd.OpenReport "rptPrintMemorial", acViewPreview
    DoCmd.RunCommand acCmdZoom100
    DoCmd.SetWarnings True
    
    End Sub

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    The error you are seeing is not a warning, it is a runtime exception. You need to trap it and handle it.

  6. #6
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    I wondered about that!!

  7. #7
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 7 64bit Access 2003
    Join Date
    Feb 2011
    Posts
    1,919
    Okay, I've added an error trap in the code that issues the OpenReport and suppressed the 2501.

    Thanks,
    Bill

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I wasn't even considering print preview earlier. But i guess it is a similar thing. As long as that print preview window is open, the docmd is not finished doing its thing.

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

Similar Threads

  1. Replies: 0
    Last Post: 03-11-2012, 09:19 AM
  2. "Group By" causes "ODBC--Call Failed" error
    By kaledev in forum Queries
    Replies: 1
    Last Post: 03-09-2011, 02:43 PM
  3. Replies: 11
    Last Post: 11-26-2010, 10:53 PM
  4. Replies: 8
    Last Post: 11-12-2010, 10:55 AM
  5. Replies: 2
    Last Post: 08-31-2006, 12:19 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