|
Access 97: I have a table with a hyperlink field that I display on a form. I can
click on the form field and the hyperlink activates correctly.
However, if I try to activate the hyperlink using VB code, the last
hyperlink that was clicked is the only one that displays.
Background: The database is for providing instruction documentation
for shop-floor personnel in a manufacturing environment. The main
purpose of the database is to provide inspection instructions. I am
adding functionality (via the hyperlinks) to also provide linked
drawings (pdf files) and Excel spreadsheets. I use a set of "preview"
and "print" command buttons on the form, and I would like to activate
the hyperlinks when a button is clicked.
The hyperlink fields on the form are unbound list boxes, and populated
with a single value by a select query. Not all records contain
hyperlinks. An OnClick event associated with each field runs the
following code:
Private Sub Drawing_Click()
DoCmd.Hourglass True
If Not IsNull(Me.Drawing) Then FollowHyperlink Mid(Me.Drawing, 2,
Len(Me.Drawing) - 2), , True
DoCmd.Hourglass False
End Sub
The Mid function strips away the "#" characters from each end of the
field's value. This code works well when the field is clicked.
I have tried several methods to activate the hyperlinks from another
Sub (associated with a print button), including calling the OnClick
event for the hyperlink field directly, duplicating the code from the
OnClick event, using the Me.Drawing.Hyperlink.Follow method, among
others. No matter what I try, if I can get the code to execute without
errors, I always get the same file when the link is executed in this
indirect manner regardless of what is actually in the hyperlink field.
If I change records and click the hyperlink field directly, this
updates the file that will repeatedly display using the indirect
method.
Any ideas?
Thank you,
Tim |