Hyperlink Query

Kapellu2

Registered User.
Local time
Today, 05:27
Joined
Sep 9, 2010
Messages
50
Hey everyone,

I am currently using Access in order to filter through items in a large database using a combo box. Each item will have a hyperlink value stored in the combo box query that will open a more detailed powerpoint report. My question is, what would the code look like to have a command button seek out that hyperlink from a given column in the combo box?

I took a shot in the dark and tried the code,

Private Sub Command110_Click()
Application.FollowHyperlink Me.Combo46.Column(9)
End Sub

But that didn't work.

Anyone know what the code would have to look like to pull this off?
 
So the stuff you want is in the 10th column of the combo? Or do you really want the 9th column? If you want the 9th column, you need to use Column(8) as it is zero-based. Also, make sure the combo's COLUMN COUNT property is set to the appropriate number or else the values won't be available.
 
Yeah I got the column thing right I think, but when I activate the command button it says Access Database cannot follow the hyperlink to #filepath#
 
Yeah I got the column thing right I think, but when I activate the command button it says Access Database cannot follow the hyperlink to #filepath#

Use

Debug.Print Me.Combo46.Column(9)

and then look in the Immediate Window to find out what it is giving you exactly.

or while the form is up and the item selected you can go to the VBA window to the IMMEDIATE WINDOW and type:

?Me.Combo46.Column(9)

and then hit enter and see what it gives you. It might not be returning what you think it should (a valid path).
 
I could not find the Immediate Window to save the life of me. I did however get the code

Application.FollowHyperlink Me.Combo46.Column(10)

to work, but only for documents saved on my desktop or my documents. For some reason if i search on other drives I get the error

"Benchmark database cannot follow the hyperlink to '#filepath#'. If I put that same hyperlink on a command button on the same form it works fine. For some reason it just has trouble opening up hyperlinks on other drives via a combo box.

Any ideas on how I might be able to get around this?
 
First of all, the Immediate Window is this:

attachment.php



When you get that error, you need to use the immediate window to find out what the value is, so we can figure out what is going on.
 

Attachments

  • immediatewindow.jpg
    immediatewindow.jpg
    77.1 KB · Views: 463
Thank you for the quick reply.

When i try those two lines of code you suggested, the path it shows seems to be correct. When I try to actually run the code I get runtime error 7971 saying it cant follow the hyperlink in the given path (the same exact path that works as a plane combo button with a hyperlink attached).
 
Post the values you are getting when you get that error. I want to see the actual path you have.
 
Hmm think I actually just figured it out. I had the table it was reading the value for that column in the combo box off saved as a hyperlink. I just changed the type to text and it works now. It seems like the followhyperlink code only works on text formats

Thanks for your help though, i really appreciate it.
 

Users who are viewing this thread

Back
Top Bottom