Stuart McLachlan
stuart at lexacorp.com.pg
Sun Jun 12 19:30:56 CDT 2005
On 12 Jun 2005 at 16:46, Arthur Fuller wrote:
> Assume a report Arthur_rpt, which is scoped by the currently selected
> PK. I want to create an HTML file from said rpt and save it to a name
> derived from the PK (i.e. 12345-T1-20050612). What is the command to to
> do this? I have read the Access help and a few related docs and still
> cannot deduce what I am to do, nor where I am to do it.
>
I gave up on trying to export reports to HTML. You get horribly bloated
HTML. The worst part is that Access creates a new table for every row and
bases the cell widths on the contents of that row so rows NEVER line up
properly.
I use VBA code to Print the HTML code directly to file from the original
recordset. That way have total control of the end product. Something like:
Open "12345-T1-20050612.htm" for Output as #1
Print #1 "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN""" & _
"""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"">"
Print #1 "<html xmlns=""http://www.w3.org/1999/xhtml"" xml:lang=""en"" >"
Print #1 "<head>"
......
Print #1, "</head>"
Print #1, "<body>"
........
........
Print #1 "<table width=""95%"" border=""0"" cellspacing=""3""
cellpadding=""4"" >"
While not rs.eof
Print #1,"<tr>" & _
"<td><center>" & rs(0) & "</center></td>" & _
"<td>" & rs(1) & "</td>" & _
"<td></bold>" & rs(2) & "</bold></td>" & _
.............
"</tr>
rs.movenext
Wend
Print #1,"</table>
........................
........................
Print "</body>"
Print "</html>
--
Stuart