Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 38
  1. #16
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

    Post the code you have behind the button please.

  2. #17
    Roncc is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2017
    Posts
    85
    I dropped the DoCmd.close and the DoCmd.OpenForm... code and it didn't make any difference, still got the error code.

    Ron C

  3. #18
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Is that the form that is *always* opened after the report?

  4. #19
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I can say that was the behavior of Access 2007 and earlier. Don't see why it would be a version specific issue since, as I mentioned, the calling procedure is notifying that the action it was supposed to perform was cancelled. Nor is it restricted to the cancelling of a report event - applies to a forms and AFAIK, other cancellable events such as OutputTo. I would have thought it to be a universal feature. Too busy getting ready for a road trip to try it on 2016. Sorry.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #20
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Thanks Micron. I believe we are closing in on the problem.

  6. #21
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by Roncc View Post
    I dropped the DoCmd.close and the DoCmd.OpenForm... code and it didn't make any difference, still got the error code.

    Ron C
    A report can be open in Dialog mode to help here.

  7. #22
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Quote Originally Posted by RuralGuy View Post
    Thanks Micron. I believe we are closing in on the problem.
    Fair enough. I shall bow out.

  8. #23
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    No...stay on the thread. I just didn't want to impact your packing. We always appreciate your input.

  9. #24
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Dialog mode halts the code that used it so that closing the report returns control to right after the OpenReport command.

  10. #25
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Did we lose you Ron?

  11. #26
    Roncc is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2017
    Posts
    85
    Yes, you're losing me; I'm don't understand your post regarding the return of control to right after the OpenReport command.

  12. #27
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Okay...answer my post #18 and we may have more that one approach.

  13. #28
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Answering my post #16 would be helpful as well.

  14. #29
    Roncc is offline Advanced Beginner
    Windows 10 Access 2010 32bit
    Join Date
    Dec 2017
    Posts
    85
    Here is the code behind the button that opens and prints the report ( I have it in preview mode now)
    Private Sub Command6_Click()
    On Error GoTo Command6_Click_Err
    'Preview a Report
    DoCmd.OpenReport "appttblstaffdateselectedrpt", acViewPreview, "", "", acNormal 'previews report
    'Print a Report
    ‘ DoCmd.OpenReport "appttblstaffdateselectedrpt", acViewNormal, "", "", acNormal 'prints report
    Command6_Click_Exit:
    Exit Sub
    Command6_Click_Err:
    MsgBox "An error has occurred. Please start over. ", vbOKOnly, ""
    DoCmd.Close 'closes current form
    DoCmd.OpenForm "appointmentschedulerfrm", acNormal, "", "", , acNormal 'opens form

    Resume Command6_Click_Exit

    End Sub

    The form appointmentschedulerfrm is the one that is always open.

  15. #30
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Quote Originally Posted by RuralGuy View Post
    Post #16 - Post the code you have behind the button please.
    Quote Originally Posted by RuralGuy View Post
    Post #18 - Is that the form that is *always* opened after the report?
    Here's the quotes.

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Run-time error 2501 for one user on one PC
    By TheBradish in forum Access
    Replies: 11
    Last Post: 06-13-2017, 04:02 AM
  2. Error 2501
    By Abacus1234 in forum Forms
    Replies: 3
    Last Post: 09-08-2015, 04:46 PM
  3. Do.cmd OutputTo Error 2501
    By Fuzz_cozens in forum Programming
    Replies: 7
    Last Post: 07-15-2014, 06:44 AM
  4. Error Handling 2501
    By RainyDay in forum Programming
    Replies: 7
    Last Post: 06-08-2013, 10:44 PM
  5. Error 2501 displays with Error handling
    By agent- in forum Programming
    Replies: 13
    Last Post: 08-05-2011, 02:20 PM

Tags for this Thread

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