I need to Export various access tables from an MDB as tab delimited text files through a Visual Basic program. If you have any suggestions it would be greatly appreciated.
Private Sub Form_Load()
Dim db As DAO.Database
Dim rs As DAO.Recordset
dim i as Integer
i = FreeFile
Set db = OpenDatabase([Database Path])
Set rs = db.OpenRecordset([SQL Query])
Open [Output Filename and Path] For Output As i
Do While Not rs.EOF
Write i, rs.Fields([field1]) & rs.Fields([field2]) & Chr(32)
'Chr(32) inserts a tab into the text file to seperate the
'fields in the recordset
rs.MoveNext
Loop
Close i
rs.Close
db.Close
End Sub
-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.