Results 1 to 8 of 8
  1. #1
    RainyDay is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Location
    Taranaki New Zealand
    Posts
    4

    Error Handling 2501

    Hi I want to open a form if the error occurs. Currently on error I get the standard access message, on debug the error is at the line i have highlighted
    Either Open a form or customise the message but the code does not seem to get to Form_Load_Err. Sorry I'm not too flash on VBA so any help, I'm grateful


    Private Sub Form_Load()
    On Error GoTo Form_Load_Err
    DoCmd.Close acForm, "frmExpired"
    DoCmd.OpenForm "frmLogon", acNormal, "", "", , acNormal <<<Error Here

    Form_Load_Exit:
    Exit Sub
    Form_Load_Err:
    MsgBox Error$

    Resume Form_Load_Exit


    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sounds like you want to trap for that specific error:

    http://www.baldyweb.com/ErrorTrap.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    RainyDay is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Location
    Taranaki New Zealand
    Posts
    4
    Hi thanks for your prompt reply, when I was scrathing arounf for an answer your Page was one I had looked at
    I tried the following but the access standard Error Box comes up

    Private Sub Form_Load()
    On Error GoTo ErrorHandler
    DoCmd.Close acForm, "frmExpired"
    DoCmd.OpenForm "frmLogon", acNormal, "", "", , acNormal
    ExitHandler: 'clean up as necessary and exit
    Exit Sub
    ErrorHandler:
    Select Case Err 'specific Case statements for errors we can anticipate, the "Else" catches any others
    Case 2501 'Action OpenReport was cancelled.
    MsgBox "No data to display"
    DoCmd.Hourglass False
    Resume ExitHandler
    Case Else
    MsgBox Err.Description
    DoCmd.Hourglass False
    Resume ExitHandler
    End Select
    End Sub

    i'm sort of in the dark over this

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Does the other form open it hour error?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    RainyDay is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Location
    Taranaki New Zealand
    Posts
    4
    No , the screen stalls on the Access Error

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Can you post the db here?

    visited NZ in April. My daughter recently moved there (Wellington). Enjoyed it!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    RainyDay is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Location
    Taranaki New Zealand
    Posts
    4
    I'll have a play to just put the essentials in as there are 50+ objects

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    50+ objects shouldn't be so big, follow instructions at bottom of my post.
    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.

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

Similar Threads

  1. runtime error 2501 openform action was canceled
    By rumenrs in forum Programming
    Replies: 2
    Last Post: 04-11-2013, 04:29 AM
  2. Replies: 6
    Last Post: 11-28-2012, 03:43 PM
  3. Suppressed run time error 2501
    By RachelBedi in forum Programming
    Replies: 8
    Last Post: 10-24-2012, 12:26 PM
  4. Replies: 15
    Last Post: 07-26-2012, 02:06 PM
  5. Error 2501 displays with Error handling
    By agent- in forum Programming
    Replies: 13
    Last Post: 08-05-2011, 02:20 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