something like this?
Public Function ExportRSToXML( _
ByVal strSql As String, _
ByVal strFileName As String) _
As Boolean
On Error GoTo ExportRSToXML_Error
Dim rs As ADODB.Recordset
Dim objStream As ADODB.Stream
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open strSql, CurrentProject.Connection, adOpenKeyset,
adLockOptimistic
Set objStream = New ADODB.Stream
objStream.Type = adTypeText
rs.Save objStream, adPersistXML
objStream.SaveToFile strFileName, adSaveCreateNotExist
ExportRSToXML = True
ExportRSToXML_Exit:
rs.Close
Set rs = Nothing
objStream.Close
Set objStream = Nothing
Exit Function
ExportRSToXML_Error:
Resume ExportRSToXML_Exit
End Function