Creating an XML Document from ADO
Sub SaveRst_ToXMLwithADO()
Dim myRecordset As ADODB.Recordset
Dim conn As New ADODB.Connection
Const strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & CurrentProject.Path & "\mydb.mdb"
conn.Open strConn
Set myRecordset = conn.Execute("SELECT * FROM Products")
On Error Resume Next
Kill "C:\yourFile.xml"
myRecordset.Save "C:\yourFile.xml", adPersistXML
Set myRecordset = Nothing
Set conn = Nothing
End Sub
Related examples in the same category