output reports as html files with working hyperlinks (1 Viewer)

G

gbotica

Guest
Hi,

I am building an Access database, that I need to
use to generate flat (i.e. no ASP or any dynamic server
hosting available) html files.

The html pages are simple list type view, with records in rows. I need to be able to click a link in each record row and see a
detail view.

The data will be managed within Access (edited etc), with
forms, and sub-forms I've made - this all works fine.

I have built 2 reports (list view, detail view) in the format I need for the html pages, and have built an export button to run the
OutputTo function, and generate the html pages.

All this seems to be working very well, but I cannot
figure out how to generate the hyperlinks on the list
view html page, with the necessary (relative) path to the
correct detail view html page.

Firstly, Access does not seem to let me have any control
over the full filenames of the html pages it generates,
they are just '[reportname]Page1.html' , '[reportname]
Page2.html'...etc

So i tried adding a text box on the report with the value
set to ="CourseDetailPage" & [CurrentRecord] & ".html" ,
and set its hyperlink property to true. This looks
perfect on the report, but when i export to html it's not
a link, it's just underlined blue text? How can I bind
this expression to a text box, and have it work as a link
in the html file?

Using the Insert Hyperlink command doesn't work either
because, i cannot bind an expression to the hyperlink
property.

is there a way to create linked pages in flat html files?
with links auomatically made?

I could easily make the course code number field on the
report a hyperlink, and it works as a link on the output
html file, but I have no control over what all the detail
view pages are called, so they are not named
course_code.html. Doing a batch rename of all the files
after the export would not work as the course codes are
non-sequential 5 digit numbers.

Can anyone help with this problem? I would be very
appreciative of assistance, I will gladly elaborate if I
have not explained it well.

thank you
 

Tim K.

Registered User.
Local time
Today, 21:48
Joined
Aug 1, 2002
Messages
242
You can use a label instead of a text box. Just create a blank lable with one space on it. Then you can add its Hyperlink Address with a blank space as well. Then use code to assign the the Address to it later. Like this.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Label4.Caption = "My HTML"
Me.Label4.HyperlinkAddress = "test" & ".html"
End Sub

This you can control the html file name you want.

Is this what you are after?
 
G

gbotica

Guest
Thanks for your reply, I think I follow you, but I don't quite understand all of that code, will it work like this...? i.e. I need to call the [CurrentRecord] funtion. What event would I need to bind this to? The OnLoad event of the report?

What does the first line of code do?

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

Me.Label4.Caption = "Click here for details"

Me.Label4.HyperlinkAddress = "CourseDetailsPage" & [CurrentRecord] & ".html"

End Sub

thanks very much for your assistance!!
 

Tim K.

Registered User.
Local time
Today, 21:48
Joined
Aug 1, 2002
Messages
242
What is the [CurrentRecord] function? What does it do? Is it a text box? What is in it? ID or sthg?

Do you open th report by clicking on a button on a form based on the current record? So only current record will show on the report.

The code I gave above is in the report, On Detail (section) Format event. Just open the report, then click on a bar above the Detail section>in Properties control, look for On Format property>click ... button on the right side of the property>add the code in.

You'll need a Label control, mine is Label4, in the report to the Hyperlink.

Your code will work if the [CurrentRecord] control is in the report.

If the [CurrentRecord] is on the form, you have to refer the code like this.

...
Me.Label4.HyperlinkAddress = "CourseDetailsPage" & "Forms![YourFormNameHere]![CurrentRecord] & ".html"
...

I am trying to figure it out what you are trying to do. You can use a bound text box in the report, bound to a Hyperlink field to accomplish the task.
 
Last edited:
G

gbotica

Guest
hi,

CurrentRecord is a function (correct term?) that returns the current record number in the current record set (or query result?) Like how =CurrentUser returns logged in username.

So as the html files from the details view report are named CourseDetailsPage2.html, CourseDetailsPage3.html, ...etc etc, the only way to link to them is to use the expression I had with [CurrentRecord] function, as each record number will relate to a page number.

I just tried your code and it works great!!! thanks a lot for your help!
 

Users who are viewing this thread

Top Bottom