Output to text file

davesmith202

Employee of Access World
Local time
Today, 17:14
Joined
Jul 20, 2001
Messages
522
I want to cycle through a table which has a field holding some text and have this output into text files.

e.g.

go to first record
output to text file and save as record1.php
repeat until end of records

Can someone provide me with just an outline for this code? My requirements are more complex but it will get me started. :)

Thanks,

Dave
 
If you want to export just the query... Look into the Docmd.tranfertext

If you need to do more complex stuff.... Look into VBA statements like:
Open
Print
Write
Close

Post back if you have any questions
 
I have had a look at that but I am confused. Just need an example so I can tweak it to my needs. Currently, I have a strMyData that holds the text I need to save in a text file called mytextfile.txt.

Anyone got a snippet of code that will do this please?
 
Sorry... but here is a copy/paste from the help...

Code:
Open "TESTFILE" For Output As #1    ' Open file for output.
Write #1, "Hello World", 234    ' Write comma-delimited data.
Write #1,    ' Write blank line.

Dim MyBool, MyDate, MyNull, MyError
' Assign Boolean, Date, Null, and Error values.
MyBool = False : MyDate = #February 12, 1969# : MyNull = Null
MyError = CVErr(32767)
' Boolean data is written as #TRUE# or #FALSE#. Date literals are 
' written in universal date format, for example, #1994-07-13# 
 'represents July 13, 1994. Null data is written as #NULL#. 
' Error data is written as #ERROR errorcode#.
Write #1, MyBool ; " is a Boolean value"
Write #1, MyDate ; " is a date"
Write #1, MyNull ; " is a null value"
Write #1, MyError ; " is an error value"
Close #1    ' Close file.

I hope this is what you are looking for ??
 

Users who are viewing this thread

Back
Top Bottom