Exporting to multiple files

  • Thread starter Thread starter RJF
  • Start date Start date
R

RJF

I have a query called qry_COPY. In this query there is a field called “YYMMâ€
(i.e. 0712, 0801, 0802, etc). I have no problem exporting the entire query
to one .txt file. But I need to be able to export the query to multiple .txt
files based on the year and month.

So for the above example, I would have 3 tables. One for the files with
“0712†in the “YYMM†field, one for the files with 0801 in the “YYMM†field,
and one with 0802 in the “YYMM†field.. And they would have to be named
0712.txt (0712.raw would be better, but I don’t know if that is possible).

Any help would be greatly appreciated.

Thanks,
 
If you have three separate tables, one for each YYMM combination, you have
.... a spreadsheet! You don't need to (nor want to) create separate tables
when all that's really required is one additional field to hold a date/time
value.

You use queries in Access to pull out whatever combination of month and year
you want to use. You can export a query (actually, the query's results) to
various file formats, including txt files.

You could create a small procedure that created a text file with a name
derived from the date/time value (or a YYMM formatting of the date/time
value).

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Hi Jeff,
Thank you for your quick response. I must not have explained myself clearly.

I have one query based on one table in access that needs to be exported to
numerous text files based on the "YYMM" field. For example, there are 100
records in the query. 25 records have "0712" in the "YYMM" field. 30
records have "0801" in the "YYMM" field, and 45 records have "0802" in the
"YYMM" field.

I need to export a .txt file for each of the different dates. So I end up
with 3 files called "0712.txt" (with only the records with "0712" in the
"YYMM" field, etc), "0801.txt", and "0802.txt". I need these text files
because the user will be importing them into a different application and they
need this data split up this way.

Basically, I don't know how to export one query into numerous different text
files based on a field in that query.

Thanks,
 
Hi,
I just created one like tat using Java where i extract bulk sp queries
in to a single file first and then create individual files with the
respective SP names. Will that help?

Vignesh.S
 
Back
Top