
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