OPen a specific file

ngs88

Registered User.
Local time
Today, 23:07
Joined
Aug 15, 2006
Messages
12
I have a database form, from which I wish to be able to open a specific pdf file. The file name used is the same as the record number field (Customer No) ie Customer No 555, file required is 555.pdf

Can anyone help with a method or code so that the file will automatically open the pdf file relevant to that record when I click a command button or something.

I tried putting a link in a bound object frame which should give an adobe icon but it throws an error message about active x or something and althogh I have done all that microsoft says should resolve it the problem still remains hence looking for another way

Please be clear as I am a novice at using code

Thanks John
 
Last edited:
open file

Here is a post from the OLDSOFTBOSS............


I use the following on a cmdButton or double click event:

Dim strProg As String
Dim strFile As String

'Open File

strProg = "C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe"
strFile = Me.FilePath

'Where Me.FilePath is the path to the file you want to open

Call Shell(strProg & " " & strFile, vbMaximizedFocus)
 
Tried this by putting a command button with no event on the form and then using code builder putting in the code

On the line strFile = Me. ------- I put the path to a file ie: C:\My Documents\ etc etc but it throws a code error something about brackets

Am I missing the point

John
 
Open a specific file

Here's a specific example using the code supplied by Rickster57

'--------------------------------------------------------------------------
' Procedure : testShell_Acrobat
' DateTime : 1/10/2007 22:04
' Author : jed
' Purpose : This is a sample of Call Shell to start a job.
' Obtained from AccessWorldForums and tested
'--------------------------------------------------------------------------
'
Sub testShell_Acrobat()


Dim strProg As String
Dim strFile As String



strProg = "d:\Program Files\Adobe\Acrobat 6.0\Reader\acroRd32.exe"
'"C:\Program Files\Adobe\Acrobat 5.0\Acrobat\Acrobat.exe"
strFile = "E:\Linksys_WRT54GR_Manual\wrt54gr-ug.pdf"
'Me.FilePath

'Where Me.FilePath is the complete path to the file you want to open

Call Shell(strProg & " " & strFile, vbMaximizedFocus)

End Sub
 
Problem is that I want it to open a file that changes with the record by using the record number as the file name
 

Users who are viewing this thread

Back
Top Bottom