Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

opening a specific pdf file from ms access

thinkhardthinkhard Member Posts: 4
I have a table with three fields, DocumentID (Primary Key), Password, Location.

What I am trying to get to happen is that our administrative office enters the documentID, password, and location (file path) into the table. They then email an employee with the ID and password. the employee goes to a form and if they enter both the ID and password correctly they hit a command button and the document opens in adobe reader so they can digitally sign it.

i have hardly any experience with vbcode and i am assuming that i am going to need some to get this to work properly.

what i have working so far is a form with a unbound text box, i can type in the location(file name) and it will open in msword.

the code i am using is:
Private Sub Command22_Click()
Dim oApp As Object

Set oApp = CreateObject("Word.Application")
oApp.Visible = True
oApp.ChangeFileOpenDirectory "d:stodatadocuments"
oApp.Documents.Open FileName:=Me.Text23 & ".doc"

End Sub


how can i get this to open a pdf in adobe reader.

Comments

  • dokken2dokken2 Member Posts: 532
    : I have a table with three fields, DocumentID (Primary Key),
    : Password, Location.
    :
    : What I am trying to get to happen is that our administrative office
    : enters the documentID, password, and location (file path) into the
    : table. They then email an employee with the ID and password. the
    : employee goes to a form and if they enter both the ID and password
    : correctly they hit a command button and the document opens in adobe
    : reader so they can digitally sign it.
    :
    : i have hardly any experience with vbcode and i am assuming that i am
    : going to need some to get this to work properly.
    :
    : what i have working so far is a form with a unbound text box, i can
    : type in the location(file name) and it will open in msword.
    :
    : the code i am using is:
    : Private Sub Command22_Click()
    : Dim oApp As Object
    :
    : Set oApp = CreateObject("Word.Application")
    : oApp.Visible = True
    : oApp.ChangeFileOpenDirectory "d:stodatadocuments"
    : oApp.Documents.Open FileName:=Me.Text23 & ".doc"
    :
    : End Sub
    :
    :
    : how can i get this to open a pdf in adobe reader.
    :

    you can open the file by shelling acrobat, the path to acrobat may be different depending on the version installed, here for 7.0:

    Dim ret As Long
    ret = Shell("c:program filesadobeacrobat 7.0
    eaderacrord32.exe d:mypdf.pdf", vbNormalFocus)

    [ideally, you would want to use the registry to determine the path to where acrobat is installed]
  • thinkhardthinkhard Member Posts: 4

    : :
    :
    : you can open the file by shelling acrobat, the path to acrobat may
    : be different depending on the version installed, here for 7.0:
    :
    : Dim ret As Long
    : ret = Shell("c:program filesadobeacrobat 7.0
    eaderacrord32.exe
    : d:mypdf.pdf", vbNormalFocus)
    :
    : [ideally, you would want to use the registry to determine the path
    : to where acrobat is installed]


    Thanks I got that to work. How can I have the shell open the file name that is typed in the unbound text box on my form? (the files are all located in the same directory)
  • thinkhardthinkhard Member Posts: 4
    got it to work, thank you for your help!
  • anastazanastaz Member Posts: 2
    :
    : : :
    : :
    : : you can open the file by shelling acrobat, the path to acrobat may
    : : be different depending on the version installed, here for 7.0:
    : :
    : : Dim ret As Long
    : : ret = Shell("c:program filesadobeacrobat 7.0
    eaderacrord32.exe
    : : d:mypdf.pdf", vbNormalFocus)
    : :
    : : [ideally, you would want to use the registry to determine the path
    : : to where acrobat is installed]
    :
    :
    : Thanks I got that to work. How can I have the shell open the file
    : name that is typed in the unbound text box on my form? (the files
    : are all located in the same directory)
    :

    is it possible to tell me how you got it working, to open a file from an unbound textbox in a form?
    i'm not a programmer, i have managed to open a specific file with the adove code, but what i really need is to open several files that i have stored their addresses in a text box. you said that you got it to work.
    i would be veery grateful i you could enlighten me, plzzz :)
  • anastazanastaz Member Posts: 2
    it's ok i got it!
Sign In or Register to comment.