dbTalk Databases Forums  

Hyperlinks don't update with new record using VB code

comp.database.ms-access comp.database.ms-access


Discuss Hyperlinks don't update with new record using VB code in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tim
 
Posts: n/a

Default Hyperlinks don't update with new record using VB code - 07-09-2004 , 07:24 AM






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

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.