Hyperlink to Word file?

B

Big Rick

Hello Folks
I am brand new to this group, so please forgive me if this turns out to be
very basic.
What I am trying to do is design a form in Access, and have the contents of
a basic text file (Word or Wordpad) automatically printed on the form. The
contents of the text file can change daily, so that is why I want to be able
to do it this way.
I did try the Hyperlink option, but this did not print out the actual
contents. It only printed out the link.
As I said before, I am brand new to this, so please can you answer in
laymans terms.

Your help is and always has been very much appreciated.
Thanking you in anticipation.
 
J

John Nurick

Hi Rick,

Assuming
(a) that this is a basic text file (that can be opened with Notepad) and
*not* a Word .doc file
(b) that the name and location of the file don't change, only its
contents:

1) In Access's VBA Editor, go to Tools|Options and click on the Editor
tab. Make sure that "Require Variable Declaration" is checked.

2) From the Insert menu, select Module.

3) Go to http://www.j.nurick.dial.pipex.com/Code/VBA/FileContents.htm
and paste the code of the FileContents() function into the new module.

4) Save the database. You'll be asked for a name for the module: call it
vbaFileContents.

5) Now switch back to the main Access window and open the form in design
view. Put a textbox on the form (if you haven't already done so) in
which to display the contents of the file.

6) If necessary, hit F4 to display the textbox's properties. Give it a
sensible name, and set its Control Source to this (using the actual name
and location of the text file):

=FileContents("D:\XXX\YYY.txt")

7) Save the form and switch to Form View.

If the assumptions (a) and (b) don't hold, things get more complicated.
Post back here with more details about what you need - e.g. where and
how to find the file that you want to be displayed, what the actual
format is, and so on.
 
B

Big Rick

Dear John.
Thank you very much.Worked first time. Exactly what I wanted.
If I am ever half as good as you, I will be a very happy man.
 
Top