Open saved file based on form textboxes (1 Viewer)

odun

Registered User.
Local time
Today, 11:14
Joined
Apr 24, 2005
Messages
108
Hello all,

Do you have a code that would open a saved file based on the contents of 2 textboxes on my form.

The saved files would be in:
C:\Documents and Settings\100310257\Desktop

I have a button on the form, but need a code that would pull up the savedfile using the name in textbox1 and the name in textbox2, like this:
textbox1-textbox2. e.g. textbox1 = Novo Group. textbox2 = AA
There is a saved file in the path above, Novo Group-AA

Thanks for helping!
 

ssteinke

for what it's worth
Local time
Today, 14:14
Joined
Aug 2, 2003
Messages
195
Code:
Dim strPath as String
strPath = "C:\Documents and Settings\100310257\Desktop"

Application.FollowHyperlink strPath & "\" & txtbox1 & "-" & txtbox2

That may work if I understand your question

Scott
 

odun

Registered User.
Local time
Today, 11:14
Joined
Apr 24, 2005
Messages
108
Hi Scott,
Thanks a lot.
I am getting a runtime error 490: Cannot open the specified file. And the Application.FollowHyperlink... is highlighted.
My file is saved on my desktop as Novo Group-AA
on my form, the 1st textbox name is textbox1, the 2nd textbox name is textbox2.

Any idea why the file can't be opened?

Thanks for helping.
 

ansentry

Access amateur
Local time
Tomorrow, 04:14
Joined
Jun 1, 2003
Messages
995
You don't have any extension on the file name e.g. .doc .xls etc.

Should be:

Code:
Application.FollowHyperlink strPath & "\" & txtbox1 & "-" & txtbox2&".doc"
 

odun

Registered User.
Local time
Today, 11:14
Joined
Apr 24, 2005
Messages
108
You're right again! Thanks John.
 

Users who are viewing this thread

Top Bottom