Shamil Salakhetdinov
shamil at users.mns.ru
Thu Feb 22 16:06:00 CST 2007
<<< IOW, no possibility AFAICT to APPEND xml files to each other, at least using the built in application method. >>> John, This is possible, starting MS Access 2002 I think - see AdditionalData object description. Here is a sample from online help. Dim objOrderInfo As AdditionalData Dim objOrderDetailsInfo As AdditionalData Set objOrderInfo = Application.CreateAdditionalData ' Add the Orders and Order Details tables to the data to be exported. Set objOrderDetailsInfo = objOrderInfo.Add("Orders") objOrderDetailsInfo.Add "Order Details" ' Export the contents of the Customers table. The Orders and Order ' Details tables will be included in the XML file. Application.ExportXML ObjectType:=acExportTable, DataSource:="Customers", _ DataTarget:="Customer Orders.xml", _ AdditionalData:=objOrderInfo <<< I must say I expected Internet explorer to show me a table though, complete with field names at the top. Wouldn't ya think? >>> You have to specify the PresentationTarget parameter with the fullpath for the .xsl file to be generated. Then additionally .htm file will be generated - and this latter will be mainly a vbscript to show your exported to .xml data in table format... -- Shamil -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Friday, February 23, 2007 12:40 AM To: 'Access Developers discussion and problem solving' Subject: [AccessD] Using XML 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 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com