
DAO Question Concerning a Word Mail Merge from Access
OK, here's what I'm trying to do. I have made a search form in Access that
allows a user to search by whatever parameters they want. Once the user had
narrowed down their search they can click a "Merge" button. This button
runs a function that takes the current form filter and generates a randomly
named Query and uses it to run acCmdWordMailMerge command. Heres some code
im using :
With dbs
Set qdf = .CreateQueryDef(queryName, sqlString)
DoCmd.SelectObject acQuery, queryName, True
RunCommand acCmdWordMailMerge
.QueryDefs.Delete qdf.Name
.Close
End With
Notice that I delete the query when the runCommand is done. I do this so
when the database is being used by 50+ users -- there isnt several hundred
temporary querys laying around. I use these queries, since as far as I
know, its the only object besides a table that will work with the
acCmdWordMailMerge command.
All of this works perfect. Word starts with all the right Mail Merge
settings/filter/etc. The user can add/delete fields and merge and print
their labels/form letters/whatever.
However, heres the problem. If the user saves his/her form letter in hope
of using it later without having to recreate it, they cant. Since, next
time the user trys using/opening the templated word document he/she used
before the old data source is gone since it was a temporary query that was
deleted the first time around.
Heres a few questions:
Has anyone tried this type of automated Word MailMerge from Access before?
If so how did you approach it?
Are you familiar with the acCmdWordMailMerge menu command? Is there anyway
to pass it an SQL string? Or anything?
Is there a way to change the force update a datasource on a predefined Word
MailMerge Document?
Can someone think of a better way to do all of this? Or point me somewhere
that may have some info.
Thanks for yout time,
Gary Striano
UCI GSM
Administrative Computing