473,466 Members | 1,378 Online
Bytes | Software Development & Data Engineering Community
Create 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 2135
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
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...
2
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.)...
5
by: Buddhist[CHinA] | last post by:
The text files are not only the .txt files, but also all ascii files. Thx.
0
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...
2
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...
3
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...
6
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...
2
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();...
5
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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...
0
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...
0
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 ...

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.