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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyperlinks created by update query don't point anywhere 1

Status
Not open for further replies.

keun

Technical User
Jul 15, 2005
262
US
I have an update query that takes a filename from a field and puts the appopriate path in front of that filename and inserts this in a new field.

The resulting field looks correct when viewed in the table, and the pointer turns to the little hand when you hover, but nothing happens when I click. When I right click to edit, the File desitination field is blank.

How can I get the text which is entered in the field to be the file destination?
 
Have a look at the HyperlinkPart method in the VBA help to understand how to use the # character in your field.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks, I tried the # and I get an error: syntax error in date.

I first had:
UPDATE [Tcar-01 TEST] SET [Tcar-01 TEST].hyper = "\\Folder1\Folder2\Folder3\Folder4"+[Filename]

This query did everything but put use the text as the address. It seems that using the HyperlinkPart Method, using leading and trailing # should make this happen.

And I changed this to:

UPDATE [Tcar-01 TEST] SET [Tcar-01 TEST].hyper = #"\\Folder1\Folder2\Folder3\Folder4"+[Filename]#

And I get the wierd date syntax error.
 
You need to have the hyperlink title before the first #. For example, setting the field to:

Code:
Google#[URL unfurl="true"]http://www.google.com#[/URL]

would create a hyperlink like:

Code:
[url=http://www.google.com]Google[/url]


-V
 
Oh, my bad. It's just the syntax you are using. In this case, the #s are part of the string literal. Try this:

Code:
UPDATE [Tcar-01 TEST] SET [Tcar-01 TEST].hyper = "#\\Folder1\Folder2\Folder3\Folder4"+[Filename]+"#";



-V
 
OK. Great! That does what I want it to do... but the links are not working.

I am trying to open TIfs that are located on a network...

Does this matter? Do I need to point Access to the proper program to handle the TIFs?
 
Have you considered avoiding all the problems of hyperlink fields and using text fields combined with FollowHyperlink instead?

Code:
Private Sub FileFullPath_DblClick(Cancel As Integer)
FollowHyperlink Me.FileFullPath
End Sub
 
"all the problems of hyperlink fields"!!!

I was not aware that there are any problems!

I will try that. I was trying to avoid making a form.

The problem is, I created this database from a txt file with 25,000,000 records. Access was crashing every time it ran so I ended up making 16 databases. Since this is only being used for a very short term project, I am trying to keep it as simple as possible.

However, if I cannot get the links to work any other way, I might end up doing the form thing.
 
It seemed to me that you were experiencing one of the problems: hyperlinks can be a problem to edit. I think you will find that a continuous form can be quite useful. If the arrow key behaviour is a problem, it can be fixed with very little code indeed.
 
OK, I think that the problem I will have with the above code is that the path is different for each of the 25,000,000 records.

Using the update query, I was able to put the path in a field in the table (call it [HyperPathField]). Can I refer to that field in the code you gave me?

Would this work:

Private Sub [HyperPathField]_DblClick(Cancel As Integer)
FollowHyperlink Me.[HyperPathField]
End Sub
 
Yes, it would. You can even combine fields/controls:

FollowHyperlink Me.[HyperPathOnlyField] & "\" & Me.[FileName]
 
WOW!!!

It's WORKING!!

No update queries!

This is great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top