View Full Version : Export Table to multiple TEXT files based on grouping of one field???


neuronship
11-29-2007, 02:27 PM
I am in need of a module that will allow data from one table to be exported to multiple text files to one central directory. The determining factor on where creation of a file ends and a new one begins will be based off one field.

Example would be Field 'ACCT_NBR' has only a possible 50 unique values with thousands of records associated to each Account Number. Mainly I am in need on how to code a loop based on a field in a table and then export a text file by each unique value. File naming convention can be the Account number with time stamp.

I look forward to any assistance that I can get!

pbaldy
11-29-2007, 02:44 PM
Generally, open a recordset on an SQL statement like:

SELECT DISTINCT ACCT_NBR FROM TableName

which will get you the unique values. Within a loop of that recordset, you can do the export for the current value. IIRC, you have to use a saved query with TransferText, so you'd probably need to have that query look to a form field for the current value, which you will place there in the loop. You can use the current value in the TransferText code to create the file name.

Dive in and post if you get stuck.