FollowHyperlink doesn't work with Windows 2000

G

Guest

I am using the following code in the onclick properties of a button on a
form. It works on our Windows XP pc's but not on the Windows 2000 pc.

Private Sub Command421_Click()
Dim strPath
Dim x
strPath = "O:\Adult Community & Housing Services\Policy Performance &
Resources\Technology & Business Support\Support Services\Accident
Reporting\Scans\"
Application.FollowHyperlink strPath & Me.DMBC & ".pdf"

End Sub

When the button is clicked the pdf file opens and then closes very quickly,
you hardly see it. Is the reason because it is a Windows 2000 pc or is there
another explanation?

The following code does work on the Windows 2000 pc and the Windows XP pc's
but I don't want to be changing code in the database and installing versions
of Acrobat every time someone get a different version of Acrobat.

Private Sub Command421_Click()
Dim strPath
Dim x
strPath = "O:\Adult Community & Housing Services\Policy Performance &
Resources\Technology & Business Support\Support Services\Accident
Reporting\Scans\"
x = Shell("C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe " &
strPath & Me.DMBC & ".pdf", 1)

End Sub

Any help with this is most appreciated.
 
G

Guest

I have found a solution myself, the following code works on the Windows 2000
pc as well:-

Private Sub Command421_Click()
Dim strPath
strPath = "O:\Adult Community & Housing Services\Policy Performance &
Resources\Technology & Business Support\Support Services\Accident
Reporting\Scans\"
CreateObject("WScript.Shell").Run Chr(34) & strPath & Me.DMBC & ".pdf" &
Chr(34)
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top