Eric Barro
ebarro at verizon.net
Sat Jul 28 20:33:17 CDT 2007
If you go this route don't forget to clean up with the following code. Otherwise you don't release the allocated memory and resources back to the server. <% rs.Close Set rs = Nothing cnn.Close Set cnn = Nothing %> -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka Sent: Saturday, July 28, 2007 5:55 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Creating HTML file I know I'm late to the party on this, but why must it be a static web page. Making dynamic pages with asp is a snap. Create the HTML in any editor you want. Then save it as an ASP page. <% Dim cnn Dim rs Dim strSQL Set cnn=server.createobject("ADODB.Connection") Set rs=server.createobject("ADODB.Connecion") strSQL="Your SQL string to get the data... 'Then connect the cnn, and open the recordset %> You now have a recordset open in asp. To use this, you can just put asp in the middle of the HTML. For example, if you have: <p>The current value is 1</p> And you want to make that 1 a value from your recordset: <p>The current value is <%=rs.fields("NumericValue").value%></p> Whalla. You can also do conditional formatting: <% if rs.fields("SomeField").value="SomeValue"%> <p>Some paragraph in the HTML document</p> <%else%> <p>Some other paragraph</p> <%end if%> You can also loop this way, for example, if you want a table with your data: <table width="100%"> <%Do until rs.EOF=True%> <tr> <%For i=0 to 4 'just assuming 5 fields%> <td width="20%"><%=rs.fields(i).Value%></td> <%next%> </tr> <%rs.movenext%> <%loop%> </table> You mentioned Frontpage, one of the handy things about Front page is that if you select something in the 'design view', when you switch to the HTML view, the HTML of the selected area will be highlighted too. Drew -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Steve Schapel Sent: Friday, July 27, 2007 4: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 The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI BusinessSensitve material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. -- 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/923 - Release Date: 7/27/2007 6:01 PM