By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,519 Members | 2,412 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,519 IT Pros & Developers. It's quick & easy.

Export to multiple text files?

P: n/a
I'm running through a database in a loop, and each time the loop
finishes I would like to export the values of some variables to new
text files. In reality it's more complex than this, but this is the
simplest way to state it.

Is there a way to write to text files and save them as different names
(presumably one of the variables dot "TXT") using Access VBA?

Dec 13 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"ManningFan" <ma********@gmail.comwrote in message
<11*********************@73g2000cwn.googlegroups.c om>:
I'm running through a database in a loop, and each time the loop
finishes I would like to export the values of some variables to new
text files. In reality it's more complex than this, but this is the
simplest way to state it.

Is there a way to write to text files and save them as different
names (presumably one of the variables dot "TXT") using Access VBA?
Are you thinking something like this Air Code?

Sub ManningFan_Test()

Dim ff As Long
Dim lngCounter As Long

For lngCounter = 1 To 100
ff = FreeFile()
Open CurrentProject.Path & _
"\Test" & CStr(lngCounter) & ".txt" For Output As #ff
Print #ff, "Test " & CStr(lngCounter)
Close #ff
Next lngCounter

End Sub

--
Roy-Vidar
Dec 13 '06 #2

P: n/a
Worked perfectly, Roy-Vidar. Thanks!

RoyVidar wrote:
>
Are you thinking something like this Air Code?

Sub ManningFan_Test()

Dim ff As Long
Dim lngCounter As Long

For lngCounter = 1 To 100
ff = FreeFile()
Open CurrentProject.Path & _
"\Test" & CStr(lngCounter) & ".txt" For Output As #ff
Print #ff, "Test " & CStr(lngCounter)
Close #ff
Next lngCounter

End Sub

--
Roy-Vidar
Dec 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.