gabester
asked on
Copy AccessDatabase to a flat file
I have an AccessDatabase. I need to grab some info from a few fields in an Access table and copy those info to a text file. How should I approach this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Emoreau's example will give you a pure Text File.. WSH2's will give you a CSV file suitable for Importing. (CSV means each field will be seperated by a column and the strings will be enclosed in double quotes)
U can also use the following function:
appAccess.DoCmd.TransferTe xt
Where appaccess is an access.application
Its the equivalent of using (in access) Export as text file
appAccess.DoCmd.TransferTe
Where appaccess is an access.application
Its the equivalent of using (in access) Export as text file
ASKER
WSH2 thanks. Your code worked really well.
Dim intNumFile As Integer
intNumFile = FreeFile
Open "C:\test.txt" For Output As #intNumFile
Do until rst.eof
Print #intNumFile, rst!Field1 & ", " & rst!Field2
rst.movenext
loop
Close #intNumFile
rst.close
Set rst = Nothing