Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 12th, 2003, 10:07 AM
Authorized User
Join Date: Jun 2003
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Default Macro

Dear Sir,

I am trying to create HTML pAges from a single Query. How would I create a macro to return One single record, to a text file(or HTML file). There are 32 records in my Query result!!!

Or can I write some code behind a form to create several different .txt or .html pages?

I would like to auto produce HTML pages, due to the information being held in the database, but my web information being in a different place. Thus not writting in the same information every month, just using the macro to populate the pages.

Than you
Old June 13th, 2003, 12:00 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts

Well, it all depends on a LOT of different things how you'd go about putting this into place.
Say for example you have some stuff at the top of the page and the bottom that remains constant, and it's only the numbers you change, well, depending on your server setup, you could use Server Side Includes to have a page call 3 different pages - the top, the bottom, and the middle.


You could export a report as HTML


You could create HTML by writing the actual HTML to a text file

Basically - there's heaps of ways to do it.

However, if you have 32 records in your query, and therefore want to create 32 different files, each with just one row of data, I'd suggest opening the query as a recordset and creating the HTML like I mentioned in the 3rd seggestion.

I'm not going to write the code here for you, just a bit of crappy pseudocode to give you an idea of what I'm on about
Initialise counter to 1
Open recordset
While not recordset.EOF
Open "ExportFile" & Counter & ".html"
   Write Header HTML tags
   Write data
   Write Ending HTML tags
Close ExportFile
Counter = Counter+1
Next record

However, as I mentioned - exactly how you implement it will be based on heaps of things - such as - Server setup, your VBA skills, how you want it saved, whether or not you can save it directly to the Web Server.

But - if you just want the first record of the query - you could always just have the query being
and export that query as HTML

Hope this points you in a more specific direction


There are 10 kinds of people in the world - those who understand binary - and those with friends

Similar Threads
Thread Thread Starter Forum Replies Last Post
calling to xlam macro from macro inside xlsb SteveB Excel VBA 0 June 30th, 2008 06:43 PM
Need Help For A Macro Code vicky.dalmia Excel VBA 1 December 16th, 2005 07:37 AM
TransferDatabase Macro jmss66 Access 13 January 21st, 2005 11:22 AM
Macro Doesn't Run? CoryKutchera Excel VBA 3 January 5th, 2005 10:30 AM
Macro Help! Jolin VB How-To 0 April 22nd, 2004 08:38 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.