Saving an ADO RecordSet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Trying to save an ADO Recordset with the code below. The file is garbage
when I open it in Notepad. Is this the correct procedure for saving
Recordsets. Can a Recordset be saved with a .xls (Excel) extension.

rst.Save "C:\My Documents\QBI0406.txt"
 
Stever said:
Trying to save an ADO Recordset with the code below. The file is
garbage when I open it in Notepad. Is this the correct procedure for
saving Recordsets. Can a Recordset be saved with a .xls (Excel)
extension.

rst.Save "C:\My Documents\QBI0406.txt"

According to the ADO help file, the Save method of an ADO Recordset
object can save the recordset either in ADTG format (the default) or in
XML format. Since you didn't specify the format, your output is
presumably in ADTG (Advanced Data TableGram ) format. I have no idea
what that format is, but I bet you can't just read it in Notepad. XML
format would be more readable.

rst.Save "C:\My Documents\QBI0406.txt", adPersistXML

You could probably import the XML into Excel if you wanted, but I've
never tried that. And of course, if this recordset comes from an Access
table or query, you could just export the table or query to Excel.
 
Back
Top