Use XML in Access 2002 to generate Web-enabled reports

By Susan Harkins and Jim DeMarco, Special to ZDNet Asia
Monday, January 13, 2003 12:00 PM

Recently, a colleague complained that one of her clients needed for her to prepare a lengthy report to distribute to personnel outside the home office. The routine was laborious at best, and she was desperate for an easier solution. I mentioned that extensible markup language (XML) might be a good alternative to her work-intensive method. Within just a few days, she produced an easy-to-implement solution and was busy reviewing other problems for possible XML-based remedies. The easy export process was her solution for getting the report out of the office.

In Access 2002, you can export Access data in XML format or import XML data into your Access database using the Access interface or Visual Basic for Applications (VBA). When you export data, Access produces several files, and you’ll need to understand each one’s purpose so that you can take an Access report to the Web.

The upshot of this solution is that you can share an XML file with almost any application running on any operating system. Realistically, it can be difficult to land just the right combination of XML options. Fortunately, once you do hit it right, it works great.

In this article, I’ll show you how to quickly create Web-ready files from Access reports using XML files that pass along the report’s data, structure, and formatting.

XML and Access
You can import XML files into Access or you can export Access objects as XML files. In this article, I’ll export Access reports to Web-ready HTM files using the XML export feature. In doing so, I’ll export the following file types:
  • XML: The actual data presented in what are known as element blocks that reference the original table fields
  • XSL: A special stylesheet that is applied to the XML file in order to format the data
  • XSD: Contains data type and constraint information
  • HTM: A Web-ready version of your Access object

You may end up using the actual XML files, but in this article, I’ll just view the resulting HTM file.

An interface example
Now, let’s use the Access interface to quickly create a Web-enabled report by exporting a report as XML. For this example, I’ll export the Catalogs report in the sample database, Northwind, that comes with Access:
  1. Open the Northwind Sample Database, and select the Catalogs report in the Database window.
  2. Choose Export from the File menu.
  3. In the Export dialog box, specify the appropriate folder (I’ll just work with the default), name the file “Catalog,” select XML Documents (*.XML) from the Save As Type control, and then click Export.
  4. In the next dialog box, specify both the Data (XML) and Schema Of The Data options, as shown in Figure A, and then click OK to generate the following files: Catalog.xml, Catalog.xsl, Catalog.xsd, and Catalog.htm.

Figure A
Select both enabled export options.


Using Windows Explorer, locate Catalog.xml and then open it in your browser. (You may have to use the Open With option if you have a Web-authoring tool that usurps the XML file association.) Figure B shows Catalog.xml in Internet Explorer. (Netscape doesn’t support XML.)

It isn’t exactly Web ready, is it? As I mentioned earlier, it’s just a bunch of tags and data. However, the export also produced Catalog.htm, which is a Web-ready file. Open it now and take a peek if you like. It should look very similar to the original Access report, as displayed in Access.

Figure B
The XML file isn’t exactly Web ready.

2 3 Next 

WORTHWHILE?

0

0 votes
Save to my library  Save to My Library  
Blog

Talkback 0 comments

There are currently no comments for this post.

Employ smoke tests at the start of your testing process

Web Development

The most basic tests any software developer must run are smoke tests, which are a set of written, non-exhaustive tests that only deal with the most functional aspects of a software application or process.


Read more »


What will social analytics say about your company?

Blog thumbnail

I was finally able to set aside some time the other night to reassess my privacy settings in Facebook, following changes made to the social network's privacy policy in December...... by Eileen Yu

Read more »

Tech Jobs Now!


Tags

  1. antivirus
  2. apple ipod
  3. cnet networks inc.
  4. desktop
  5. e - mail
  6. hard drive
  7. mcafee inc.
  8. microsoft corp.
  9. microsoft windows
  10. microsoft windows xp
  11. network
  12. norton co.
  13. operating system
  14. pc
  15. performance
  16. security
  17. software
  18. tool
  19. web
  20. web site