Exporting Reports to multiple text files using vba 
Author Message
 Exporting Reports to multiple text files using vba

I am using MS Access 97.

I need to be able to create a set of txt files ie an export from a set
of queries.

I can set up and export a single query, however, I want to create txt
files as seperate reports and name them as seperate files.

eg  Queries based on animals sub of mammal, reptile, fish etc

I want to output all fish, mammal etc as seperate files... saved as
text... based on the same report...

I know I need VBA to do this

A working example would be:

Animal, mammal, dog
Animal, mammal, cat
Animal, fish, pike
Animal, Reptile, gecko
Veg, root, Carrot
Veg, fruit, orange
etc..

I want a report to output, on seperate txt files using reports:

I want an index page like so:

Animals
====
Mammals
Fish
Reptiles

Veg
====
Root
Fruit

etc

Then the main documents saved as seperate files:

Mammals
====
Dog
Cat

Fish
====
Pike

Reptile
====
Gekho

Root
===
Carrot etc...

I want the Reference of the code used for each heading to be the name of
the file

eg

Index

A, Animal
B, Veg
C, Mineral

a.txt = animals
b.txt = veg

etc...

and so on

a1.txt = animals, mammals
a2.txt = Animals, fish
b1.txt = veg, root
c1.txt = min, salt

etc...

I know how to export them individually, however, I want and need to
maintain a single database and automatically output the reports as
required replacing the old ones. I have used vba quite a lot, but, as I
am self taught I just don't know where to turn.

I think I would have to use a loop, however, if I delete a category it
would be out of sequence!

Thanks

Steve



Sat, 03 Aug 2002 03:00:00 GMT  
 Exporting Reports to multiple text files using vba
As a foot note I have tried doing this with a query using a loop but the
query does not refresh/requery and reports the same data again and again...

there is still the problem with data file names and loops because if I name
the a1.txt file to be mammals i always want it to stay that way or I will
always have to update the index!

Regards

Quote:

> I am using MS Access 97.

> I need to be able to create a set of txt files ie an export from a set
> of queries.

> I can set up and export a single query, however, I want to create txt
> files as seperate reports and name them as seperate files.

> eg  Queries based on animals sub of mammal, reptile, fish etc

> I want to output all fish, mammal etc as seperate files... saved as
> text... based on the same report...

> I know I need vba to do this

> A working example would be:

> Animal, mammal, dog
> Animal, mammal, cat
> Animal, fish, pike
> Animal, Reptile, gecko
> Veg, root, Carrot
> Veg, fruit, orange
> etc..

> I want a report to output, on seperate txt files using reports:

> I want an index page like so:

> Animals
> ====
> Mammals
> Fish
> Reptiles

> Veg
> ====
> Root
> Fruit

> etc

> Then the main documents saved as seperate files:

> Mammals
> ====
> Dog
> Cat

> Fish
> ====
> Pike

> Reptile
> ====
> Gekho

> Root
> ===
> Carrot etc...

> I want the Reference of the code used for each heading to be the name of
> the file

> eg

> Index

> A, Animal
> B, Veg
> C, Mineral

> a.txt = animals
> b.txt = veg

> etc...

> and so on

> a1.txt = animals, mammals
> a2.txt = Animals, fish
> b1.txt = veg, root
> c1.txt = min, salt

> etc...

> I know how to export them individually, however, I want and need to
> maintain a single database and automatically output the reports as
> required replacing the old ones. I have used vba quite a lot, but, as I
> am self taught I just don't know where to turn.

> I think I would have to use a loop, however, if I delete a category it
> would be out of sequence!

> Thanks

> Steve

--
Regards

Steve



Sat, 03 Aug 2002 03:00:00 GMT  
 Exporting Reports to multiple text files using vba

:As a foot note I have tried doing this with a query using a loop but the
:query does not refresh/requery and reports the same data again and again...

Well, here's a sample on how to sequence filenames, but it will probably
require some rework to get the filenames in the format you are looking for.

< http://www.mvps.org/access/api/api0005.htm >

 -- Dev



Mon, 05 Aug 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Exporting a report to a text file (from VBA)

2. VB crashing after multiple reports exported using the RDC

3. Export "Query Text" using VBA

4. Use parameter Query to export to multiple text files

5. Exporting multiple reports as on PDF file

6. Need to export multiple files from one report

7. Export to a .pst file using VBA

8. export report to a text file HELP!!!

9. export crystal report to a text file

10. export a report result into a text file**

11. Access 2000, Export Text File - Using TransferText Command

12. Opening Multiple Files using VBA

 

 
Powered by phpBB® Forum Software