Opening File based on Value in Form

Jarad

Registered User.
Local time
Yesterday, 23:43
Joined
Jul 3, 2007
Messages
19
I am trying to open a PDF from an access form. That part is easy, the hard part is that the name of the pdf is the value of a field in the form. And it needs to automatically assign that value to the name of the file I am trying to open.. I have

Private Sub Command52_Click()
On Error GoTo Err_Command52_Click

Dim stAppName As String


stAppName = "S:\Ops\English - Home Savings\Credit Bureau\credit bureau\" & Me.AcctNumber & ".pdf"

Call Shell(stAppName, 1)

Exit_Command52_Click:
Exit Sub

Err_Command52_Click:
MsgBox Err.Description
Resume Exit_Command52_Click

End Sub

The value in Acctnumber needs to go right on the end of "bureau\" and then the ".pdf" on the end so it would look like this if it worked

S:\Ops\English - Home Savings\Credit Bureau\credit bureau\999999.pdf

the 999999.pdf being added automatically.. Any one have any ideas??
 
That looks like it will build the path correctly. I believe Shell expects the path to the executable first. You could try FollowHyperlink instead, which doesn't.
 
Got It

I found this and it works like a charm


Private Function set_my_link()
Me![PDFButton].HyperlinkAddress = "S:\Ops\English - Home Savings\Credit Bureau\credit bureau\" & Me.AcctNumber & ".pdf"

End Function

Private Sub PDFButton_Click()
Me![PDFButton].HyperlinkAddress = "S:\Ops\English - Home Savings\Credit Bureau\credit bureau\" & Me.AcctNumber & ".pdf"
End Sub
 

Users who are viewing this thread

Back
Top Bottom