Results 1 to 4 of 4
  1. #1
    cbjames is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Apr 2016
    Posts
    2

    Angry Access shuts down on Error? How to stop this?

    I have an Access database screen that hyperlinks to documents stored in specific folders. If the hyperlink finds the document it open just find. But, If there is NOT a document there it throws an error (which is perfectly fine). However, after you click the error message to close, e database closes and you have to open it up all over again. Here is my 'very basic' code.
    Private Sub cmdDocCharges_Click()
    '
    Application.FollowHyperlink "\\corp.heb.com\dfs\Distribution\Transportation\Inb oundLog\Public\Produce Supporting Docs\Carrier Rejection Charges" & DLookup("TripID", "qms_Truck_Issue_Email") & ".pdf"
    '
    Exit_cmdDocCharges_Click:
    Exit Sub
    Err_cmdDocCharges_Click:
    MsgBox Err.Description


    strMsg = "No documents for this TripID."
    MsgBox strMsg
    Resume Exit_cmdDocCharges_Click
    '
    End Sub


    Any thoughts would be greatly appreciated. I am stumped.

  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,643
    It shouldn't happen with proper error handling:

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

  3. #3
    cbjames is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    Apr 2016
    Posts
    2
    I used the "On Error GoTo ErrorHandler"... and now everything works perfect. Thank you so much!!

  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,643
    Happy to help. You had part of it, but not the key part.

    Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Access shuts down when exporting to text file
    By mgrlvr in forum Import/Export Data
    Replies: 21
    Last Post: 11-16-2015, 09:59 AM
  2. How to stop Microsoft Access Error 3817?
    By SwenGyrowetz in forum Database Design
    Replies: 4
    Last Post: 07-27-2015, 04:28 AM
  3. Execution Shuts on version change
    By drunkenneo in forum Access
    Replies: 2
    Last Post: 07-13-2015, 04:46 PM
  4. Replies: 8
    Last Post: 01-13-2015, 12:23 PM
  5. Replies: 2
    Last Post: 11-29-2009, 12:00 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