Save Each Record from a Query As An Individual Word File

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query that I run frequently. I've been asked to
put the contents of each record of the query into separate word documents.
For example, if there are 100 records, there should be 100 word files
generated, one for each record.

I'd like each document to save automatically using the value of a specific
field (the unique field) as the file name. The documents always get saved
into the same directory.

Ideally, if I click a command button to run the query (or after I run a
query), the files should be created and saved based on the data from the
query.

Any sample code, links to resources or tips would be greatly appreciated.

Thanks,
Andrew
 
You could open a Recordset from the query. Then loop through each record and
merge the data. Some Word autmation will have to come into play aswell so you
can save each merge with a specified name...quite involved.

Another option may be to do it with a report and output to a .rtf file.
To do this, you could loop through the recordset (as above) and output the
report (based on same query) using the Primary key field as criteria with
each call. You could also use this field to name the .rtf file.

Steve
 
Back
Top