pass a variable to a hyperlink

jmack

New member
Local time
Today, 11:56
Joined
Sep 17, 2003
Messages
6
I have a form in my "Trainings" db that when opened displays a filenames and an option group (A thru M) for filtering purposes. For example: Button "A" displays files(both Word and Powerpoint files) that begin with the letter "A".

I want to link directly to a specific file when that file is selected from the form.
Right now I am able to link to the Directory and Folder but not the specific file. Is there a way to pass a variable(filename) to the Hyperlink ?

Thanks for any help.
 
A little more information might be helpful. For example, how are you opening the hyperlink? Are you using the FollowHyperlink method? Or are you doing something when the user clicks on the document name?

You might try overlaying the document name with a transparent Command Button with a hyperlink address and subaddress programmatically assigned.

Jim
 
Jim, thanks for the quick response and sorry for the lack of info.

I guess I'm using a combination of both procedures. In the 'on-click" event of my textbox(filenames) I execute an event procedure:

Private Sub Dept_Click()
FollowHyperlink strMyDocPath
End Sub

Private Sub Form_Load()
strMyDocPath = "\\DC-1\company\Trainings\"
End Sub

Private Sub ID_Click()
On Error GoTo Err_ID_Click
FollowHyperlink strMyDocPath & Me.Dept & ".doc"
Exit_ID_Click:
End Sub

In the Command button method, what do I supply in the "HYPERLINK SUB ADDRESS" field that will direct it to a specific file via my textbox selection?
I'm using Access2k if it makes a difference.

Thanks again........
 
I think the SubAddress field will get tacked onto the Hyperlink, separated by a "#". So the web page you're hyperlinking to could parse its location with a bit of JavaScript and redirect to the linked document (for example). Anyway, that'd be a way to get the identity of the document to somewhere the web page could examine and act on it.

Jim

PS - See
http://www.devguru.com/Technologies/ecmascript/quickref/location.html

for how to pick apart a window location in JavaScript..
 
Jim, thanks again for your help. I was able to pass the variable to the hyperlink by placing the following in the onclick event of one of my fields.

Private Sub Dept_Click()
Application.FollowHyperlink "\\X\company\Trainings\" & Me![Dept]
End Sub

It worked like a charm.

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom