Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HYPERLINKING WITH A MACRO

Status
Not open for further replies.

ETID

Programmer
Jul 6, 2001
1,867
US
Anyone know how to create a hyperlink upon closing of a form, to a network file named for a field in that form?

I.E.

In my form I have a field named letter_number bound to a table called letters.

if the field is populated with "Jan_01_sales_mm01"

I want it to create a hyperlink in the table to "x:\Sales\Jan_01_sales_mm01.pdf"

...sound do able?
 
Would this be a bound or unbound form? Do you mean Macro in the generic or specific? A Macro in Excel uses VBA but a Macro in Access doesn't.

Let's say this is a relatively easy thing to do using VBA code in the Close action if it is a bound form and you can set a hyperlink field in the table to a value. The issue is persistence. A command button has properties to place the hyperlink address but it needs somewhere to store that address. If you set the property at runtime then the next time you open it you will find it is not there. If you store the value in a field of the table and update the button properties in the OnCurrent event then the table will act as the storage media for persistence of the address. If it is an unbound form then you could store the value of the hyperlink in the registry and assign it to the form button when you reopened the form.

----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
The form is bound to the table...

As it is now the users enter ...let's say, Jan_01_sales_mm01
in the field. along with other specifics in other fields.

Then I go into the table and set the hyperlinks in the table, from the menu, to their coresponding documents on the "X" drive.

But I would like code to set the link, picking up the file name from the form and concatenating the rest of the path (static)...ie "x:\Sales\"& field_with_letter_name & ".pdf"

...does that make it clearer?
 
My recommendation would be to create a hyperlink field in the table and populate it and the hyperlink properties of a command button from the ControlName_AfterUpdate event. Then, in the Current event you can set the values of the command button hyperlink properties from the value of the stored field.

ControlName_AfterUpdate
' Set the value of the field
' Set the value of the command button hyperlink
End

Form_Current
' Set the value of the command button hyperlink
End
----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
Hmmmmm...Do you have an example? I'm lost on the syntax :-(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top