473,661 Members | 2,502 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Export to multiple text files?

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
2 2707
"ManningFan " <ma********@gma il.comwrote in message
<11************ *********@73g20 00cwn.googlegro ups.com>:
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
12838
by: atse | last post by:
Hi experts, I retrieve data from the database and display on ASP, then I export these data to a file, like Excel (the best) or text file. Is it possible? I think it is possible, but how can I do that? Thanks for any help. Atse
205
10593
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
1
6580
by: Charlie | last post by:
Hello, I have data in an Access table that I would like to export to multiple HTML tables. I would like to split the data in the Access table (about 92,000 records) into multiple HTML tables/files to reduce download time and bandwidth usage on my web server. That way, the user can select a particular page to download instead of downloading a page with all of the records. I would like to set a limit of only 500 records per file.
3
4897
by: Jorge Cecílio | last post by:
Hi! I would like to export some MS-Access reports output to pdf. However, the only possibility offered by Access (afaik) for me to export formatted output is snp (snapshot) (I use MS-Office XP Prof. 2002 version). With formatted output I mean the *exactly* output I produce from executing my report (information is gathered from an ODBC database).
9
3002
by: | last post by:
I have a web page written in asp.net that has multiple datagrids on it that would need to be exported to Excel. Each of the datagrids would be a subset of what the datagrid above it was. Thus far, I've had no luck in finding anything to work reliably. Some of the files I've saved (using a radio button click event), will open fine in Excel, others give me an "Unable to open file" message. Any help appreciated.
5
3413
by: JHNielson | last post by:
I have a somewhat simple question, but have been baffled by it for a while, and now I'm on a tight deadline - have to get it done within 24 hours. I am trying to export a set of files to my hard drive to then later be FTPd to a server. the file format should be "TITLE.yyyymmdd" where yymmdd is the date code for when the files are created. The files can't be .txt. But when I run the files as ".txt" the code runs just fine. when I...
6
4147
by: jefftyzzer | last post by:
Friends: Let's say I'd like perform a delete, but before I delete, I'd like to export the target rows. I could use an export whose SELECT clause references the OLD TABLE of a DELETE, but the issue is I'm deleting the table in chunks, like so: WHILE (V_NO_DATA = 0) DO DELETE FROM
2
1856
by: Sashi | last post by:
Hi All, I have a table from which I want to export the data as a plain text file. I exported the data using the "Export" option and selected the comma as a separator and the " as the Text Qualifier. I have about 19800 records but a few hundred are broken over multiple lines. That is, the majority of records are exported correctly but some of
1
6187
by: CF FAN | last post by:
Can Report Builder Export Excel Files with multiple Sheets How can I create a report that it can export in excel by multiple
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8855
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8758
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7364
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.