[AccessD] HTML from Access Report (was mistakenly stolen from:Creating HTML file)

John Bartow john at winhaven.net
Sun Jul 29 16:52:46 CDT 2007


Eric,
Thank You.

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Eric Barro
Sent: Friday, July 27, 2007 5:49 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] HTML from Access Report (was mistakenly stolen
from:Creating HTML file)

John/Steve,

Here's the code I used a while back when I was still developing in Access
97. If I was doing this today I'd probably re-write the code and make it
more modular and use cascading style sheets for formatting.

The basic format for any HTML file is...

<html>
	<head>
		<title>Page Title</title>
		<LINK href="your_style_sheet.css" type="text/css"
rel="StyleSheet">
		<script src="your_javascript_code.js"></script>
	</head>
	<body>
	</body>
</html>

I would not hard-code any javascript or css but instead link to them at
runtime as I've shown above in the <head> section. Pay special attention to
the construct """. In most cases you can use "'" instead.

----------------------------------------------------------------------------
------------------------
Private Sub CreateHTMLFile(strHTMLFileName As String, strImage1 As String,
strImage2 As String, strDesc1 As String, strDesc2 As String, strInsured As
String, strPolicy As String)

Open strHTMLFileName For Output As #1

Print #1, "<html>"
Print #1, "<head>"
Print #1, "<meta http-equiv=""Content-Type"" content=""text/html;
charset=iso-8859-1"">"
Print #1, "<title>Photo Template</title>"
Print #1, "<script language=""; JavaScript; "">"
Print #1, "<!--"
Print #1, "function MM_reloadPage(init) {  //reloads the window if Nav4
resized"
  Print #1, "if (init==true) with (navigator) {if ((appName==""; Netscape;
"")&&(parseInt(appVersion)==4)) {"
    Print #1, "document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }}"
  Print #1, "else if (innerWidth!=document.MM_pgW ||
innerHeight!=document.MM_pgH) location.reload();}"

Print #1, "MM_reloadPage(true);"
Print #1, "// -->"
Print #1, "</script>"
Print #1, "</head>"
Print #1, "<body bgcolor=""#ffffff"" link=""#0000ff"" vlink=""#ff0000""
text=""#000000""  topmargin=0 leftmargin=0>"
Print #1, "<div id=""Logo"" style=""position:absolute; width:285px;
height:55px; z-index:13; left: 15px; top: 0px""><img src=""afslogo.gif""
width="; 281; " height="; 54; "></div>"
Print #1, "<div id=""TopHeader"" style=""position:absolute; width:400px;
height:55px; z-index:15; left: 300px; top: 0px"">"
  Print #1, "<table width="; 351; " border="; 0; ">"
    Print #1, "<tr>"
      Print #1, "<td>"
      Print #1, "<div align=""Right""><b><font face=""Verdana, Arial,
Helvetica, sans - serif"" size="; 2; ">" & strInsured & "</b></div>"
        Print #1, "<div align=""Right""></div>"
      Print #1, "</td>"
    Print #1, "</tr>"
    Print #1, "<tr>"
      Print #1, "<td>"
      Print #1, "<div align=""Right""><b><font face=""Verdana, Arial,
Helvetica, sans - serif"" size="; 2; ">" & strPolicy & "</b></div>"
        Print #1, "<div align=""Right""></div>"
      Print #1, "</td>"
    Print #1, "</tr>"
  Print #1, "</table>"
Print #1, "</div>"

Print #1, "<div id=""Photos"" style=""position:absolute; width:685px;
height:900px; z-index:14; left: 15px; top: 55px"">"
  Print #1, "<table width="; 679; " border="; 0; ">"
    Print #1, "<tr>"
      Print #1, "<td width="; 41; "> </td>"
      Print #1, "<td width="; 586; "><img src=" & strImage1 & " width=";
588; " height="; 396; "></td>"
      Print #1, "<td width="; 37; "> </td>"
    Print #1, "</tr>"
    Print #1, "<tr>"
      Print #1, "<td width="; 41; "> </td>"
      Print #1, "<td width="; 586; "><font face=""; Verdana, Arial,
Helvetica, sans - serif; "" size="; 2; "><b>" & strDesc1 & "</td>"
      Print #1, "<td width="; 37; "> </td>"
    Print #1, "</tr>"
    'Print #1, "<tr>"
    '  Print #1, "<td width="; 41; "> </td>"
    '  Print #1, "<td width="; 586; "> </td>"
    '  Print #1, "<td width="; 37; "> </td>"
    'Print #1, "</tr>"
    Print #1, "<tr>"
      Print #1, "<td width="; 41; "> </td>"
      Print #1, "<td width="; 586; "><img src=" & strImage2 & " width=";
588; " height="; 396; "></td>"
      Print #1, "<td width="; 37; "> </td>"
    Print #1, "</tr>"
    Print #1, "<tr>"
      Print #1, "<td width="; 41; "> </td>"
      Print #1, "<td width="; 586; "><font face=""; Verdana, Arial,
Helvetica, sans - serif; "" size="; 2; "><b>" & strDesc2 & "</td>"
      Print #1, "<td width="; 37; "> </td>"
    Print #1, "</tr>"
  Print #1, "</table>"
Print #1, "</div>"
Print #1, "</body>"
Print #1, "</html>"

Close #1

End Sub



----------------------------------------------------------------------------
------------------------

Eric 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of John Bartow
Sent: Friday, July 27, 2007 2:41 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] HTML from Access Report (was mistakenly stolen
from:Creating HTML file)

Hi Eric,
I guess I'm not after quite the same thing as Steve (so sorry I chimed in on
your thread Steve, I'll rename mine).

I had tried something of this sort with A97 and it didn't work. Now
obviously things have changed a lot since then but could you please
elaborate a bit on this.

What I wish to do is to run a process that creates static html pages from
data stored in the database and places them into a folder (which is used by
FrontPage). 

There two approaches I have considered:
Write out a text file and use FP VBA to manipulate it into using the default
css theme.

Or (since I know the css tags) embed the tags directly into the data output
from Access. (I would prefer this as I have no desire to learn FP's object
model, as it is a dead horse now). I was thinking (hoping, really) that I
could do this with a report and use labels (or eventually a lookup table and
text fields) to embed the html/css code. I would then output these reports
to the folder of choice using the windows generic text only printer.

Any thoughts on this?

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Eric Barro
Sent: Friday, July 27, 2007 4:17 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Creating HTML file

Steve,

Grab any HTML editor that generates HTML (preferably drag and drop) and
design your page and save it as an HTML file. And then you can open it with
Notepad and use the generated HTML source code.

Eric

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Schapel
Sent: Friday, July 27, 2007 2:04 PM
To: Access Developers discussion and problem solving
Subject: [AccessD] Creating HTML file

Hi.  I am just about to do something I have never tried before.  I need to
create a static web page from Access data.  Using OutputTo from a report has
too many problems.  Using DoCmd.TransferText acExportHTML doesn't give me
the formatting flexibility that I need.  Therefore I've decided to try to
loop through a recordset and build the html file in code.  Main problem
being that my html skills are minimal.  Has anyone done this type of thing?
Any tips?  Thanks.

Regards
Steve
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.10.22/922 - Release Date: 7/27/2007
6:08 AM
 

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list