What works in my PC does not work in a Remote PC

Maxine Nietz 1 Reputation point
2024-05-22T20:12:17.5866667+00:00

I have written a database for someone else and installed it in their PC. It works just fine.

Now they want an update - to be able to view PDFs from Access. This works just fine from my PC with the command: Application.FollowHyperlink "C:\Users\nevadamax\Documents" & Me.[PDFName]

but does NOT work in the Remote PC. The error is "Cannot open this type of file."

References set in both PCs are:

Access Reference Issue

I think that adding the extra references (in the red box) to the Remote PC would solve the issue.

1.How can I add the references I need?

2.Is there another reason for the problem besides references?

Thank you in advance for your help!

Max

 

Access Development
Access Development
Access: A family of Microsoft relational database management systems designed for ease of use.Development: The process of researching, productizing, and refining new or existing technologies.
843 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Karl Donaubauer 1,726 Reputation points MVP
    2024-05-24T10:42:21.5+00:00

    Hi,

    1. The FollowHyperlink method has nothing to do with the VBA References. So, this is not the reason for the error.
    2. Your posted code is missing a backslash after "Documents" which would result in an uncorrect path and would lead to error 490 "Cannot open the specified file.". As you state a different message and that it works on your PC, the missing backslash might be a mistake in the post here. Nevertheless you should check the correctness of the resulting path with a MsgBox or Debug.Print.
    3. Are you sure that the error is coming from Access/VBA? If yes, what's the error number you get?

    If no, then the program that FollowHyperlink is trying to launch to read the PDF might be a problem or might have a problem with the file. Is it a standard PDF or any particular advanced type of PDF?

    Servus
    Karl


    Access Forever
    Access News
    Access DevCon
    Access-Entwickler-Konferenz AEK

    1 person found this answer helpful.
    0 comments No comments

  2. Maxine Nietz 1 Reputation point
    2024-05-23T16:17:28.8466667+00:00

    The PDFs work perfectly!!! They can be opened in Adobe Reader. The problem is with MICROSOFT ACCESS, not ADOBE!!! Don't try to pass the buck. I need answers to questions 1 and 2.

    0 comments No comments

  3. Ken Sheridan 2,751 Reputation points
    2024-05-24T10:30:17.69+00:00

    To add a reference you simply scroll down the list and tick the relevant checkbox. I doubt that this is the problem here, though. Over the years I've seen a number of instances where .pdf files can be a little temperamental when the FollowHyperlink method of the Access Application object is used.

    You might like to take a look at BrowseDemo.zip in my public databases folder at:

    https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169

    This little demo file illustrates how to associate one or more external files with a record. More to the point in your case it calls the Windows API ShellExecute function to open or print a file, using the following module:

    Option Compare Database

    Option Explicit

    Public Const SW_HIDE = 0

    Public Const SW_SHOWNORMAL = 1

    Public Const SW_SHOWMINIMIZED = 2

    Public Const SW_SHOWMAXIMIZED = 3

    Public Const OP_OPEN = "Open"

    Public Const OP_PRINT = "Print"

    Declare PtrSafe Function ShellExecute& Lib "shell32.dll" Alias "ShellExecuteA" (ByVal _

    hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal _

    lpParameters As String, ByVal lpDirectory As String, ByVal nshowcm As Long)

    Dim lngRetVal As Long
    
    Dim lngHwnd As Long
    ```Sub ShellToFile(strPath As String, _
    
    ```vba
    Optional strOperation As String = OP_OPEN, _
    
    Optional lngShow As Long = SW_SHOWNORMAL)
    
    Dim lngRetVal As Long
    
    Dim lngHwnd As Long
    
    lngHwnd = Application.hWndAccessApp
    
    lngRetVal = ShellExecute(lngHwnd, strOperation, strPath, vbNullString, CurDir, lngShow)
    
    If lngRetVal < 32 Then
    
        MsgBox "Unable to open/print file " & strPath, vbInformation, "Warning"
    
    End If
    ```End Sub