Modifying button hyperlink according to record... (1 Viewer)

MissJulie

New member
Local time
Today, 10:04
Joined
Feb 2, 2010
Messages
8
Hi All...

I have a table called Furnishings

Furnishings
||ID||Name||specLink||

speckLink contains a link to a PDF

eg a set of 3 records

||1||XO corner cove||C:\specs\xocc.pdf||
||2||GD mid link||C:\specs\gdml.pdf||
||3||key backer||C:\specs\kb.pdf||

I have a split form for this table, where i can obviously add and view records.

What i have been trying to do with no luck is create a button on the form that when clicked will open the respective pdf for the selected record. i understand that you can specify a hyperlink but the value remains static. i want it to be dynamic so the link changes dependant on the record selected.

Im not good when it comes to coding, so would really appreciate some advice or guidance on this.

Thanks.
Julie
 

ghudson

Registered User.
Local time
Today, 05:04
Joined
Jun 8, 2002
Messages
6,195
try this in the onclick event of your button...

Code:
application.followhyperlink [specLink]
 

SOS

Registered Lunatic
Local time
Today, 02:04
Joined
Aug 27, 2008
Messages
3,517
Or, without a button you could use a double click event of the file name to open it. Kind of intuitive that would be. :)
 

MissJulie

New member
Local time
Today, 10:04
Joined
Feb 2, 2010
Messages
8
thanks.. this might sound a bit dumb.

but for both solutions where would i make the necessary changes?

ie. where could i do the double click event, is that on the field in the form. if so how do i tell it to open the file?

and for the other possible solution where would i code

application.followhyperlink [specLink]
 

thabounceisback

Registered User.
Local time
Today, 02:04
Joined
Sep 17, 2009
Messages
31
When you create the command button in design view, right click it. Choose the "Event" tab and you should find a field named "OnDoubleClick." Click the field and the ellipses to the right and chose "code builder" from the ensuing dialogue box. From there you will insert the code as specified in previous posts.
 

SOS

Registered Lunatic
Local time
Today, 02:04
Joined
Aug 27, 2008
Messages
3,517
When you create the command button in design view, right click it. Choose the "Event" tab and you should find a field named "OnDoubleClick." Click the field and the ellipses to the right and chose "code builder" from the ensuing dialogue box. From there you will insert the code as specified in previous posts.

And I found a visual way of that, if it helps.
 

MissJulie

New member
Local time
Today, 10:04
Joined
Feb 2, 2010
Messages
8
Thanks. I have tried this but nothing happens when i click the button.

The code I have is

Option Compare Database (was already there)

Private Sub Command38_Click()

Application.FollowHyperlink [specLink]

End Sub

any suggestions? i tried a few other things in the code builder earlier too and nothing happend either. even simple things like.

field2.text = field1.text

and nothing happens. do i need to set something else up too?
 

JANR

Registered User.
Local time
Today, 11:04
Joined
Jan 21, 2009
Messages
1,623
If the field on your form that holds the hyperlink use a refrence to this field like:

Application.FollowHyperlink & Me!NameOfField[/QUOTE]

JR
 

MissJulie

New member
Local time
Today, 10:04
Joined
Feb 2, 2010
Messages
8
Still no luck! Please help!

I tried
----------------------------------------
Private Sub Command38_Click()

Application.FollowHyperlink Me![specLink]

End Sub
-----------------------------------------
And also
-----------------------------------------
Private Sub Command38_Click()

Application.FollowHyperlink & Me!specLink

End Sub
-----------------------------------------

Nothing seems to do anything. Am i inputing this in the right place?
Does it have to be a certain file type or will it work on any?
Does the path/link have to be in a certain format?

Please help!
 

JANR

Registered User.
Local time
Today, 11:04
Joined
Jan 21, 2009
Messages
1,623
Private Sub Command38_Click()

Application.FollowHyperlink Me!specLink

End Sub

My bad remove the ampersand and it shoud work.

JR
 

MissJulie

New member
Local time
Today, 10:04
Joined
Feb 2, 2010
Messages
8
Thanks.. have tried that but nothing seems to happen at all!

How can I tell if on click it is actually even trying the code?
 

JANR

Registered User.
Local time
Today, 11:04
Joined
Jan 21, 2009
Messages
1,623
I'm at a loss, perhaps you could upload a samplebase?

JR
 

ghudson

Registered User.
Local time
Today, 05:04
Joined
Jun 8, 2002
Messages
6,195
just put a simple message box in the onclick event of your button to see if it is firing.

Code:
msgbox "test"

What is the actual name of the text box that is used to display the file path info? Not the name of the table field that is storing the file path info.
 

Users who are viewing this thread

Top Bottom