Results 1 to 7 of 7
  1. #1
    christ2000 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    45

    Question Help With error Runtime 16388

    Hello i using Application.FollowHyperlink to open pdf files on my database and work find but when I cancel the operation to open the file I get a runtime error 16388. please how can I cancel this error and just close the dialog box?



    thanks in advance

  2. #2
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    christ2000 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    45
    Thanks but do not work for me, here is my code:

    rivate Sub Command469_Click()
    Dim filename As String
    Dim Filepath As String
    Dim CName As String
    On Error GoTo err_chk
    CName = Forms![ContractorsDBForm]![Text442]
    filename = Me.DocumentsName & ".pdf"
    Filepath = DLookup("[ContractorPath]", "querysetup") & CName & DLookup("[expr1]", "querysetup") & CName & " " & filename


    If Dir(Filepath) = "" Then
    MsgBox "Document not found, or is not in PDF format"
    Else
    Application.FollowHyperlink Filepath


    err_chk:
    If Err.Number = 16388 Then
    MsgBox "THIS DOCUMENT DOES NOT EXIST"
    Else
    MsgBox Err.Number & ": " & Err.description
    End If

    End If

    End Sub

  4. #4
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    You need to resume following that specific error, and your error handler has no previous exit method.
    Try this (untested air code)

    Code:
    
    Private Sub Command469_Click()
        Dim filename As String
        Dim Filepath As String
        Dim CName As String
        
        On Error GoTo err_chk
        
        CName = Forms![ContractorsDBForm]![Text442]
        filename = Me.DocumentsName & ".pdf"
        Filepath = DLookup("[ContractorPath]", "querysetup") & CName & DLookup("[expr1]", "querysetup") & CName & " " & filename
    
    
    
    
        If Dir(Filepath) = "" Then
            MsgBox "Document not found, or is not in PDF format"
        Else
            Application.FollowHyperlink Filepath
    
    
        End If
      
    ExitCommand469_Click:
        Exit Sub
        
    err_chk:
            If Err.Number = 16388 Then
                MsgBox "THIS DOCUMENT DOES NOT EXIST"
                Resume ExitCommand469_Click
            Else
                MsgBox Err.Number & ": " & Err.Description
            End If
    
    
    End Sub
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    christ2000 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    45
    ork perfect thanks, do you think is there any way to avoid show a dialog box when user cancel(
    MsgBox "THIS DOCUMENT DOES NOT EXIST") and just when user press cancel the dialog box close?

  6. #6
    Minty is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    Simply remove the message box code !
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  7. #7
    christ2000 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    45
    You ROCK... thanks

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

Similar Threads

  1. Runtime error 459
    By mermaidboy in forum Access
    Replies: 2
    Last Post: 01-02-2018, 05:49 AM
  2. Replies: 3
    Last Post: 02-26-2016, 12:34 PM
  3. Replies: 2
    Last Post: 08-22-2015, 11:26 AM
  4. Replies: 2
    Last Post: 10-15-2014, 04:23 AM
  5. Replies: 13
    Last Post: 06-12-2012, 09:52 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