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

Using query to format text as hyperlink

Status
Not open for further replies.

hefly

Technical User
Feb 6, 2008
134
US
Is there a way to convert query text results as hyperlink?

I have two text fields, MyPath and FileName

Can I concatenate these fields into a query result that is a hyperlink?

I've looked at the Format function, but can't find any reference to formating my concatenated field to hyperlink data type.

Code:
MyPath: ("." & "\" & [Path] & "\" & [FileName])

Thanks!

Hefly
 
Simply set your result as a hyperlink property of a label.

Dim MyPath as String
MyPath = "." & "\" & Me.Path & "\" & Me.FileName
Me.Label8.Hyperlink.Address = MyPath

This is a simple example but if you type 'Hyperlink' into ms vba help you will find it there

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work
 
MazeWorX! Thank you.

I get an error with the following event. The first line shows up red:

Code:
Private Sub Report_Load()
 [COLOR=red]  Dim MyPath as StringMyPath = "." & "\" & Me.Path & "\" & Me.FileName [/color red]
   Me.Label8.Hyperlink.Address = MyPath
End Sub
 
Dim MyPath as StringMyPath = "." & "\" & Me.Path & "\" & Me.FileName

Needs to be 2 separate lines
Dim MyPath as String
MyPath = "." & "\" & Me.Path & "\" & Me.FileName

Keep in mind the label name needs to match your report also the field names need to be there as well. You can or should change them to suit

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work
 
MazeWorX:

This helps... now, however, the VB can't find Path or Filename.

I have my form based upon a query. qryRunsheet and the Path and FileName are in this query.

qryRunsheet.Path and qryRunsheet.FileName

query is based upon tblRunsheet

Code:
Dim MyPath As String
MyPath = "." & "\" & Me.Path & "\" & Me.FileName
Me.Label55.Hyperlink.Address = MyPath



 
is this form for running the report?

HTH << MaZeWorX >> "I have not failed I have only found ten thousand ways that don't work
 
I have a table with the file name. What I am trying now is:

Update a hyperlink field with the file name to create a hyperlink. I want the hyperlink to appear in the report. I can't get the link to work. Here is what else I have tried:

Code:
UPDATE tblRunsheet SET tblRunsheet.Path = "." &"\" & [FileName];

I have tried creating a query that produces the following as a path:

Code:
OLG715.pdf#file:.\a\OLG715.pdf#

The application resides in the same folder "a" as the file "OLG715.pdf"

Any suggestions that might make the hyperlink on the report active?


 
How are ya hefly . . .
hefly said:
[blue]Any suggestions that might make the hyperlink on the report active?[/blue]
To my knowledge [purple]this can't be done.[/purple] However I do seem to remember reading that 2007 circumvents this. I just can't be sure until I find the resource again. In any case, for pre 2007 the hyperlinks should work if you [blue]output the report to Word, Excel or HTML.[/blue]

As for the field your updating, it has to be a [blue]Hyperlink[/blue] datatype! If you havn't done so ... add a hyperlink field to the table.

I query your syntax method in prescribing the address:
Code:
[blue]OLG715.pdf#[purple][b]file:.\a\OLG715.pdf[/b][/purple]#[/blue]
I've never seen such a syntax. Until you get it working use the full path to the file. Then you can change to your syntax to see if it works or not.

To start, update the hyperlink field to:
Code:
[blue]OLG715.pdf#[purple][b]FullPathToFile[/b][/purple]#[/blue]

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top