Using a command button to open a file in another field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database that includes a reference to a document that is unique to
each record (an essay submitted by the person in the record). I use a form
to view the data for each essay author. I'd like to be able to click on the
command button and open the essay. Essays are not in any one specific format
(Word, WP, txt, etc). Is this possible?
 
Thanks for the reply. Forgive the basic (not BASIC!) question I'm about to
ask, but do I do that after creating the command button, right clicking on
it, opening "Properties" and putting this information in the "Hyperlink
Address" field? Or where do I do this?

Also, does the "me!" you type mean I put in the database file name?

Again, sorry for the basic question.

-an
 
If the field has the full path name, and a document (word, excel etc...),
then just go:


application.FollowHyperlink me!YourFieldNameWithDocumentName

The document will be launched (along with the appropriate application) as if
you double clicked on it.....
 
No, you are making a button that runs code.

You simply type in the Visual basic commands I showed into the code editor.

For example, you could create a button when click says hello. The code would
be:


Msgbox "hello"

The series of steps to add a button to a form, and put code behind it are
here:

http://www.members.shaw.ca/AlbertKallal/wordmerge/Details.htm

In the above, we were putting in some different code. To summary:

Open the form in design mode.

Place a button on the form (don't use the wizard in this case).

right click on the button, and choose "code builder"

You should be transferred to the visual basic code editor, and you should
get something like:

Private Sub Command16_Click()

End Sub

Now, you just type in your code that you want. in our case, the code was:

application.FollowHyperlink me!YourFieldNameWithDocumentName

Of course, I can't read you mind, so just type the name of the field you
used:

application.FollowHyperlink me!FieldWithFullDocName

All you need here is one line of code....
 
Back
Top