Results 1 to 4 of 4
  1. #1
    mortonsafari is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2015
    Location
    Brisbane, Queensland, Australia
    Posts
    39

    Handling Error 490 in a Module

    I have a Switchboard which runs off the Switchboard Items Table to run Functions in a Module.

    The Module has Functions that open PDF files located on our ‘public’ drive.

    Function Example:
    [ Public Function OpenV2()
    'Open the V2-Staff Code of Conduct Policy.pdf located at
    'P:\xxxxxx\sss-Forms

    Application.FollowHyperlink "P:\xxxxx\sss-Forms\V2-Staff Code of Conduct Policy.pdf"

    End Function ]

    If the file is not located, Access throws an Error 409 message.

    I would like the following Message Box to appear, and then when the ‘user’ clicks the OK button, the ‘user’ goes back to the Switchboard.

    [ MsgBox "The PDF file is not in the location it should be" & Chr(10) & _
    " so have the Data Coordinator correct the problem!" & _
    Chr(10) & Chr(10) & "Clicking the OK button return you to the Menu."
    'Cancel the action
    Cancel = True ]



    What is the best way to handle the Error?

    Thanks in anticipation of any help received

    Mortonsafari

  2. #2
    Bullschmidt's Avatar
    Bullschmidt is offline Freelance DB Developer
    Windows 10 Office 365
    Join Date
    Mar 2020
    Location
    USA
    Posts
    64
    Perhaps something like this might work for you...

    Code:
    Public Function OpenV2()
        'Open the V2-Staff Code of Conduct Policy.pdf located at
        'P:\xxxxxx\sss-Forms
    
    On Error GoTo Err_OpenV2
    
        Application.FollowHyperlink "P:\xxxxx\sss-Forms\V2-Staff Code of Conduct Policy.pdf"
    
        Exit Function
    
    Err_OpenV2:
        MsgBox "The PDF file is not in the location it should be" & Chr(10) & _
        " so have the Data Coordinator correct the problem!" & _
        Chr(10) & Chr(10) & "Clicking the OK button return you to the Menu."
        'Cancel the action
        Cancel = True
    
        Exit Function
    
    End Function

  3. #3
    mortonsafari is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2015
    Location
    Brisbane, Queensland, Australia
    Posts
    39
    Many thanks. I had finished up with something similar . . .

    [ Public Function OpenV1()
    On Error GoTo Err_OpenV1
    'Open the V1-Volunteer Record Sheet.pdf located at "P:\xxx\xxx-Forms"

    Application.FollowHyperlink "P:\xxx\xxx-Forms\V1-Volunteer Record Sheet.pdf"

    Exit_OpenV1:
    Exit Function

    Err_OpenV1:
    MsgBox "The PDF file is not in the location it should be" & Chr(10) & _
    " so have the Data Coordinator correct the problem!" & _
    Chr(10) & Chr(10) & "Clicking the OK button will return you to the Menu."
    'Cancel the action
    Cancel = True
    Resume Exit_OpenV1

    End Function ]

    But I will add the [ Exit Function ] after the [Application.FollowHyperlink "P:\xxxxx\sss-Forms\V2-Staff Code of Conduct Policy.pdf" ]

    Thanks for your reply

    Cheers

    Mortonsafari

  4. #4
    Bullschmidt's Avatar
    Bullschmidt is offline Freelance DB Developer
    Windows 10 Office 365
    Join Date
    Mar 2020
    Location
    USA
    Posts
    64
    Way to go and glad I was able to help

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

Similar Threads

  1. #Error in calculated control despite error handling
    By TrainingExcellence in forum Access
    Replies: 2
    Last Post: 08-07-2019, 07:45 PM
  2. Replies: 5
    Last Post: 09-06-2015, 12:06 PM
  3. Error handling of table update error?
    By panoss in forum Forms
    Replies: 5
    Last Post: 10-31-2014, 02:06 PM
  4. Replies: 3
    Last Post: 09-05-2012, 10:23 AM
  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