Add Hyperlink to report? (1 Viewer)

Big Pat

Registered User.
Local time
Today, 18:33
Joined
Sep 29, 2004
Messages
555
Hi,

Is it possible to add a hyperlink to a report? My database contains details of various clinical trials running in the UK and I can produce a report showing those that are potentially open for new hospitals to join.

I "print" this report to a PDF file so I can email it to various doctors and managers who don't have access to my database. There is also a web-based national database of such trials and it would be great to be able to include a hyperlink to the right URL from within my report.

I've got this working when I display the records on a form...

Code:
'Declare a temporary variable to store the main part of the hyperlink address
Dim URLpart1 As String

'Now, actually store it there
URLpart1 = "http://public.ukcrn.org.uk/Search/StudyDetail.aspx?StudyID="

'Set the hyperlink address of the button to temp variable declared above & the ID number
Me.cmdHyperlink.HyperlinkAddress = URLpart1 & Me.UKCRN_ID

....but is there any way to make this work on a report? Access lets me add a button (I was going to make it transparent and place it over the detail line in the report) but there is no 'Event' where I can attach code.

Is there any way around this?

Thanks,
 

vbaInet

AWF VIP
Local time
Today, 18:33
Joined
Jan 22, 2010
Messages
26,374
If you have Access 2007 or 2010 then you can get the button to fire the On Click event if the report is opened in Report View. Other versions of Access reports don't fire click events.
 

Big Pat

Registered User.
Local time
Today, 18:33
Joined
Sep 29, 2004
Messages
555
Thanks for the reply. It's pretty much what I thought. I didn't know Access 2007/10 would do that, but the recipients are never going to see the report view anyway. They see only the PDF.

Ok, so that won't work! What other approach could I use? I could send the report as an Excel attachment rather than a PDF (although I suspect this would mean formatting it in Excel each time :() I've amended my underlying query to add a field called "Hyperlink", with the source "http://public.ukcrn.org.uk/Search/StudyDetail.aspx?StudyID=" & [UKCRNID]

But that just results in a text string, i.e. the "hyperlink" doesn't work. Is there anything I can do in the query design to make that field behave as a link? Or is there anything I can do in Excel to convert a column of text (which could be hundreds of rows long) to "real" hyperlinks? I'm using both Access and Excel 2003.

Thank you.
 

vbaInet

AWF VIP
Local time
Today, 18:33
Joined
Jan 22, 2010
Messages
26,374
My version of Acrobat Reader follows a web link that is text. Maybe you want to get your recipients to upgrade to the latest version.

That failing, I think there's a Hyperlinks property of a cell or Column which you can use to associate a hyperlink to that cell or there's FollowHyperlink. Obviously these methods would require you to

1. Export to Excel - http://www.btabdevelopment.com/ts/default.aspx?PageId=47
2. Open the workbook and apply the changes to that whole column
3. Save, close and send

Or perform all functions in batches before sending.

This question would be more suited in the Excel section of the forum just so you can be advised of another approach.
 

Users who are viewing this thread

Top Bottom