Sub PersistRecordset()
Dim strFileName As String
strFileName = "c:\test.txt"
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection
rst.CursorType = adOpenStatic
rst.LockType = adLockOptimistic
rst.Open Source:="Select * from Employees ", Options:=adCmdText
On Error Resume Next
Kill strFileName
'Save the recordset
rst.Save strFileName, adPersistADTG
rst.Close
Set rst = Nothing
End Sub
|