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

Replacing text

Status
Not open for further replies.

pookie62

Technical User
Oct 22, 2004
139
GB
Hi,
In a table I have a guys clubname, but also the club URL.
What I would like is showing on the report the clubname being a hyperlink to the club URL.
This report is published on the web.
Is this possible ??
If so, how ???

Thanks in advance !
Hans
 
You can place a label box on the report where you would like the URL to appear. Right click on the label box to go to properties. On the format tab, fill in the name of the Club as the caption and the URL as the hyperlink address.

If you want to dynamically assign these values, you will need to use VBA. If it is a static report, the values can be hardcoded.
 
Hi Tigelili3,
Thanks for your reply. Indeed I would like it to be dynamic.
Can you give me an example how the VBA code should be ?
Thanks very much !!
 
In VBA you dynamically assign value to the Caption and HyperlinkAddress properties of the Label object in the Format event procedure of the section.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi PH,
Can you please give an example ?
Can this be a textbox on the report on which you dynamically asign values ?
There is a textbox now called 'Vereniging' (Dutch for Club)
and it's control source is a table field.
What I want is that, depending on which member (Name) is listed, the clubname (Vereniging) is presented, being a hyperlink (from clubURL) for exporting to HTML.

Thanks !
Hans
 
I said a label, not a bounded textbox.
While in VBE (Alt-F11) display the Object Browser window (F2), choose the Hyperlink member of the Label class and press F1 to get a code example.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I'm sorry but it doesn't..
Somehow the help function in Access isn't doing what it's supposed to, and I can't get an example..
Could somebody please post a small example how to start this code ?
Appreciate !!
 
As an example of how it is done in the on open event of a form...

Code:
Private Sub Form_Open(Cancel As Integer)
Dim hlk As Hyperlink
Dim strAddress As String
strAddress = "[URL unfurl="true"]http://www.msn.com"[/URL]
        Set hlk = lblClub.Hyperlink
            With hlk
                .TextToDisplay = "Go Club"
                .Address = strAddress
            End With
End Sub

To make it dynamic, you would change strAddress. Since you already have the names of the clubs in a table, my suggestion would be to put the web addresses as a column in the same table. Then create a combo box on a form with a rowsource that includes both the Club Name and web address. You can make the web address invisible in the combo box by setting the column width of the column that contains it to 0. For example, if your rowsource lists club name first and web address second, set the column widths in the properties as follows: 1";0". You would then set strAddress equal to your combo box selection like this:
Code:
strAddress = [forms]![frmYourFormName]![lblYourLabelName].column(2)

Give it a try and post if you have additional questions.

Debra
 
I'm sorry! The code above for strAddress should read:

Code:
strAddress = [forms]![frmYourFormName]![cboYourComboBoxName].column(1)

The numbering of columns in combo boxes begins with 0 instead of 1 so the second column would be column 1.

You can also set the text to display dynamically as follows:
Code:
Dim strText as String
strText = [forms]![frmYourFormName]![cboYourComboBoxName]

You do not need the column reference if you are looking for the first column.

I hope this helps!

Debra
 
Thanks a lot Debra !
Going to try this and let you know..
Hans
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top