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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dumping data to a .txt file

Status
Not open for further replies.

ahoover

Programmer
Feb 4, 2004
20
0
0
US
How can I dump data that would normally go into a database to dump into .txt file? What's the command and could you write a line or two? Thanks.
 
Sorry to be vague- but you take the data wherever it is and you just print or write it to a file - as opposed to writing it to the database. It is hard to show you since you don't specifiy where the data in question is coming from. But let's say it is in a variable named foo.
Code:
Open "c:\textfile.txt" for output as #66
print #66, foo
close #66

Of course you do not need to hard code the file location or number- but this gets the point across.

 
Dim hFile As Integer
hFile = FreeFile
Open "x:\myfile.txt" For Output As #hFile
Print #hFile, "line 1 to write to the file"
Print #hFile, "line 2 to write to the file"
Close hFile

Paul Bent
Northwind IT Systems
 
that works great...but what I had intended was for it to take multiple requests and keep filling up...not erasing over the old data. Is there a way to do that?
 
change output to append
for example:
Open "C:\myfile.txt" For Append As #1
Print #1, "HELLO"
Close #1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top