Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing to a text file from a recordset

Status
Not open for further replies.

shep6

Programmer
Joined
May 4, 2001
Messages
38
Location
GB
Can anyone help me out with the code needed to write data (3 fields) contained in a DAO recordset in Access to a .txt file. After each line I need to put a carriage return. I guess I need to loop through the recordset writing each line to the text file, but I am not sure of the code needed.

thanks in advance.

ps. there is no table which holds this data, and I don't want to create a temporary table to hold it first.
 
I don't know the Access model, but know the method you need.

Open file-name as string for append as #1
loop defined here
Print #1, output-string
return to top of loop
Close #1

At each iteration of the loop, the output-string will print on a new line. SuperBry!
 
Thanks, now sorted, this pointed me in the right direction!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top