473,756 Members | 6,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create multiple text files based on customerID

11 New Member
I need to run a monthly audit on a customer invoice database that prints off order totals per customer. Ex. If customer 1234 has 4 orders for the month I want to see the text file as follows: 1234 10.21 101.22 22.11 82.01 (The OrdersTotaltbl already stores the order totals and CustID). The problem for me is that I need to output a separate file for each customer file saved as the CustID. There is currently a list of 200+ regular customers ordering at least twice a month. What would be the best way to set this up?
Dec 5 '07 #1
3 2160
Denburt
1,356 Recognized Expert Top Contributor
Do you already have a routine for exporting at least one customer? If so that would save some time here. If you do have a routine for that then you would just need to open the recordset and use a loop statement to cycle through each of the clients and run your export routine at that time. Something like the following.

Expand|Select|Wrap|Line Numbers
  1. set rs = db.openrecordset("clientsOrders")
  2.  
  3. Do until rs.eof
  4.   strQuery = "Select * from clientsOrders Where ClientID = " & rs!ClientID
  5.     Db.Execute _
  6.     "SELECT * INTO [Text;FMT=Delimited;HDR=" & strHdr & ";DATABASE=" & strPath & ";].[" & StrFile & "#csv] FROM " & strQuery, _
  7.     dbFailOnError
  8. rs.movenext
  9. loop
Dec 5 '07 #2
ezra
11 New Member
Do you already have a routine for exporting at least one customer? If so that would save some time here. If you do have a routine for that then you would just need to open the recordset and use a loop statement to cycle through each of the clients and run your export routine at that time. Something like the following.

Expand|Select|Wrap|Line Numbers
  1. set rs = db.openrecordset("clientsOrders")
  2.  
  3. Do until rs.eof
  4.   strQuery = "Select * from clientsOrders Where ClientID = " & rs!ClientID
  5.     Db.Execute _
  6.     "SELECT * INTO [Text;FMT=Delimited;HDR=" & strHdr & ";DATABASE=" & strPath & ";].[" & StrFile & "#csv] FROM " & strQuery, _
  7.     dbFailOnError
  8. rs.movenext
  9. loop
Currently I have nothing in place. This is something new the boss has thrown at me! Thanks for this. It does give me a better idea of what I need to do.
Dec 5 '07 #3
Denburt
1,356 Recognized Expert Top Contributor
Currently I have nothing in place. This is something new the boss has thrown at me! Thanks for this. It does give me a better idea of what I need to do.
Your quite welcome glad I could help. I know I left a lot out so if you need any assistance in implementing this just post back. O.K. here is a little more and should get you a bit closer.

Expand|Select|Wrap|Line Numbers
  1.    1.
  2.       set rs = db.openrecordset("clientsOrders")
  3.     strHdr = "Yes"
  4.     strPath = "C:\Client Support\DailyReport\"
  5.  
  6.       Do until rs.eof
  7. StrFile = Format(Date(), "yyyy-mm-dd") & " " & RS!ClientName
  8.    strQuery = "Select * from clientsOrders Where ClientID = " & rs!ClientID
  9.    Db.Execute _
  10.    "SELECT * INTO [Text;FMT=Delimited;HDR=" & strHdr & ";DATABASE=" & strPath & ";].[" & StrFile & "#csv] FROM " & strQuery, _
  11.              dbFailOnError
  12.          rs.movenext
  13.       loop
Dec 5 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
6602
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.
2
1747
by: Chris Murphy via DotNetMonster.com | last post by:
Hey all, just wondering if anyone can point me in the right direction. I'm developing a solution that allows a user to store multiple text-based content (like code snippets, notes, documents etc.) in one master document. I'm not exactly sure which is the most efficient method of going about this. Should I: a. Use a container file like a CAB file and read/write separate textfiles to it? b. Save all "documents" in a collection and serialize...
5
3442
by: Buddhist[CHinA] | last post by:
The text files are not only the .txt files, but also all ascii files. Thx.
0
1142
by: Srini | last post by:
How to Creates multiple output files during a single unload? I understand from IBM's documentation saying this is possible using High Performance Unload, Versio 2.2. But unfortunately, we do not have this facility. Can someone help me with this please. FYI- we are using DB2 v815 on z/OS. Thanks.
2
2723
by: ManningFan | last post by:
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?
3
5713
emaghero
by: emaghero | last post by:
Hello all, I want to open multiple txt files with similar names in C++ I have attempted this with the following code //Create as many txt files as there are valid propagation constants //Propagation constants are elements of the vector beta for(int j=0;j<(int)(number_of_nodes);j++){ if(*(beta+j)>substrate*k && *(beta+i)<core*k){ FILE *p_j; p_j=fopen("c:\\data_j.txt","w"); }
6
30733
by: borthouth | last post by:
Hi, I have just started using Python and I am slowly getting into it. I wanted to make a little script to merge all files in a directory into one. All of these files will be text files. I know I need to use os.path.walk() to walk through all the files, and if not os.path.isdir(filename) with open(filename,'r').read() to read all the files that are not directories. Can someone give me a clue or a very simple example that I can work...
2
4206
by: as001 | last post by:
Hi, I'm writing a windows application in C# using VS 2003. I got stuck where it has to write multiple output text files. Here's my piece of code: for loop { Random r = new Random(); //use millisecond and random to avoid similar filename
5
14680
by: maral | last post by:
Hi every one, this is my first post here! I'm using GATE toolkit for information retrieval and text analysis, but i really need java for some parts. I have managed to find a specific word in one text file, but i need to look for a specific word, in multiple text files. all of the files are ".txt" and they are in the same folder but each of them with different names. I have written the following code: but i receive an error that i don't...
0
9255
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
10014
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
9689
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
8688
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...
1
7226
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6514
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3780
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
2
3326
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.