[AccessD] Using XML

JWColby jwcolby at colbyconsulting.com
Thu Feb 22 15:39:51 CST 2007


One of the things I try to do when my classes prepare reports to send off to
my client's clients is to log the data sent.  Doing this allows me to have a
record of what was sent in case there is ever a dispute.  The data is rarely
if ever used but a nice security blanket if you will.  One of the problems
with doing this is simply that since the data is custom to that report, a
custom table has to be created to hold the data.  I have also taken to
outputting the file in a dated format as well as the "generic name" that the
client receives - with the date and time that the file was output.
 
I was in the middle of trying to figure out how to do this "generically"
(you know me, make it available always) when it suddenly occurred to me...
why not create an XML file instead of (or in addition to) my dated file.
The xml file could have the identical name as my dated file except that it
would have an XML extension.  The XML is supposed to be "a table" in text
format (kinda).
 
Unfortunately I was working in A2K ( the least common denominator at this
specific client) so I stopped, opened the project in Access 2002, and added
a couple of lines of code to my report generator, and voila, XML files.  
 
I had to modify my mclsRptName (holds all of the names of my reports plus
text streams) to add an XML file spec string and property, and then
 
Application.ExportXML acExportQuery, mRSP_QueryName,
mclsRptName.pFileSpecXML
 
and I had an XML report sitting in the directory along with the other files.
 
Unfortunately, the XML file causes Windows Explorer to open to display it,
and then displays the xml text, not tables.  My question is, is there some
sort of viewer that can display the data in tables?  I mean for just
browsing data, XML is hardly intuitive to the human mind.
 
Also unfortunate of course is the OVERHEAD.  Holy smoke batman, a 15 kbyte
file turns into a 91 kbyte file.
 
And finally, unfortunately, whereas my custom class knows how to use the
same text stream object to write the date, the application.ExportXML simply
writes the last query presented to the file name.  since my files can be a
header, detail and footer, the footer will be the only thing there if a
footer is the last query presented, the detail will be the last thing if the
detail query is the last query presented etc.  IOW, no possibility AFAICT to
APPEND xml files to each other, at least using the built in application
method.
 
I am jazzed though how easy it was to do the xml thing.  I must say I
expected Internet explorer to show me a table though, complete with field
names at the top.  Wouldn't ya think?
 
John W. Colby
Colby Consulting
www.ColbyConsulting.com
 



More information about the AccessD mailing list