opening documentation file from Forms

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

I have a 'help' file in word format. I file is the help
documentation for a form in access. I would like to place
a command button to open this document.
the file is located in the file pathg like
C:\Tools\Inventory\help.doc
This is a fixed location for the file.
I am new to access forms..so plz help me in this
application.

Thanks for any pointers.
Peter.
 
I have a 'help' file in word format. I file is the help
documentation for a form in access. I would like to place
a command button to open this document.
the file is located in the file pathg like
C:\Tools\Inventory\help.doc
This is a fixed location for the file.
I am new to access forms..so plz help me in this
application.

Thanks for any pointers.
Peter.
 
Helo,
Thanks for the help..when I pasted your code to the
onclick event of my command button, an error pops up "the
database cannot locate Use Shell(.."
any idea why??
thanks
cheers
peter
 
You will have to put the full path in then for word
Shell ("C:\Program Files\Microsoft Office\Office10\WINWORD.exe .....

Check your version to find whether its Office10, or Office11 etc where
Winword.exe is located.
 
Remove the word "Use" and start the line with the word "Shell".

Another alternative would be to use the FollowHyperlink command.
Add a new standard module (from the "Modules" tab in the database window).
Paste the following code (watch out for the forum's line-wrapping; there
should only be four lines):

Sub OpenLink(strFilename As String)
strFilename = Replace(strFilename, " ", "%20")
Application.FollowHyperlink Address:=strFilename, SubAddress:="",
NewWindow:=True
End Sub

Then, for your button's click event you would have:

Call OpenLink("C:\Tools\Inventory\help.doc")

You can use the OpenLink routine any time from any form where you want to
open a file, open an image, play a sound file, etc.
 
Back
Top