A
Archie
The story so far:-
I am creating a mail merge source. Each record contains 20 cells which are
the results of 4 Access queries which each return 5 columns of data. Because
each query result may be up to 500 rows, I bring each query result into a
separate Word doc (using Insert/Field/Database), from which I then paste
special (as unformatted text) each column into the applicable cell in the
merge source. I then delete the table imported from Access and do the same
again for the next query.
The goal is a letter which includes 4 tables listing transaction data for
the client.
The Access queries will be named in the style "ABC DEF XXXX(XX)", "ABC GHI
XXXX(XX)", "JKL DEF XXXX(XX)" and "JKL GHI XXXX(XX)", where XXXX(XX) is 4 or
6 alpha characters which identify the client. There are currently 65 and
codes will be added and deleted over time i.e. 260 queries to start with.
I have this working fairly crudely by recording macros, but I'm sure a VBA
routine would be much more economical. In particular, I would like a routine
which includes a list of the client codes, and uses each of them in turn to
create the name of the 4 queries to get. Secondly, to know where in the mail
merge source to insert the data (alongside the corresponding client account
no., name and email address, I've thought of using bookmarks but it will be
pretty tedious), and finally to repeat the full sequence (get data, select
column, copy column, paste special to another doc, return to the other doc,
select next column and so on 4 more times per query, delete table, get data
etc 3 more times per client).
I suspect the process is far from ideal in any case, but do want to stick
with Word for the time being for various reasons. Thanks for your indulgence
and help.
I am creating a mail merge source. Each record contains 20 cells which are
the results of 4 Access queries which each return 5 columns of data. Because
each query result may be up to 500 rows, I bring each query result into a
separate Word doc (using Insert/Field/Database), from which I then paste
special (as unformatted text) each column into the applicable cell in the
merge source. I then delete the table imported from Access and do the same
again for the next query.
The goal is a letter which includes 4 tables listing transaction data for
the client.
The Access queries will be named in the style "ABC DEF XXXX(XX)", "ABC GHI
XXXX(XX)", "JKL DEF XXXX(XX)" and "JKL GHI XXXX(XX)", where XXXX(XX) is 4 or
6 alpha characters which identify the client. There are currently 65 and
codes will be added and deleted over time i.e. 260 queries to start with.
I have this working fairly crudely by recording macros, but I'm sure a VBA
routine would be much more economical. In particular, I would like a routine
which includes a list of the client codes, and uses each of them in turn to
create the name of the 4 queries to get. Secondly, to know where in the mail
merge source to insert the data (alongside the corresponding client account
no., name and email address, I've thought of using bookmarks but it will be
pretty tedious), and finally to repeat the full sequence (get data, select
column, copy column, paste special to another doc, return to the other doc,
select next column and so on 4 more times per query, delete table, get data
etc 3 more times per client).
I suspect the process is far from ideal in any case, but do want to stick
with Word for the time being for various reasons. Thanks for your indulgence
and help.