Re: Mail Merge Module fails to open Data Source
- From: "Van T. Dinh" <VanThien.Dinh@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 23 Apr 2005 17:57:41 +1000
Just the start for you in DAO:
1. Create 2 Queries called:
qryContractData_Base
qryContractData_Custom
qryContractData_Base is the same with your original SQL without the WHERE
condition, i.e. is:
****
SELECT DISTINCTROW tblClientData.FileNumber, tblClientData.ClientFullName,
tblClientData.SpouseFullName, tblClientData.ClientRole
FROM tblClientData
****
The SQL String of the qryContractData_Custom is not important as we modify
it in code. You can simply copy the qryContractData_Base and rename the new
copy qryContractData_Custom
2. Before you start the MailMerge execution code, code something like
Dim db As DAO.Database
Dim qdf as DAO.QueryDef
Set db = DBEngine(0)(0)
Set qdf = db.QueryDefs("qryContractData_Custom")
qdf.SQL = db.QueryDefs("qryContractData_Base").SQL & _
" WHERE tblClientData.FileNumber = " & Me.FileNumber
qdf.Close
Set qdf = Nothing
Set db = Nothing
DoEvents
and then continue your MailMerge code but use the qryContractData_Custom as
the DataSource. Since this query is not parametrised (the Parameter has
been resolved to explicit value), Word MailMerge will be able to use it.
This way, you don't have to use temporary Table.
It is probably true that MailMerge can use the Table faster than the Query
but without method, you need to use a Make-Table Query to select Record(s)
to create the Table (which need hard-disk writes) then the code needs to
read from the hard-disk again. You then have to delete the Table (hard-disk
access again).
With the customised Query like above, the whole process only involve the
selection similar to the selection done by your Make-Table Query. Thus, the
customised Query should be much faster for the whole process.
--
HTH
Van T. Dinh
MVP (Access)
"Robert Blair via AccessMonster.com" <forum@xxxxxxxxxxxxxxxxx> wrote in
message news:4ec463bced964db181560489ea925531@xxxxxxxxxxxxxxxxxxxx
> I'm going to take your advice and explore the DAO method.
.
- Follow-Ups:
- Re: Mail Merge Module fails to open Data Source
- From: Robert Blair via AccessMonster.com
- Re: Mail Merge Module fails to open Data Source
- References:
- Mail Merge Module fails to open Data Source
- From: Robert Blair via AccessMonster.com
- Re: Mail Merge Module fails to open Data Source
- From: Van T. Dinh
- Re: Mail Merge Module fails to open Data Source
- From: Robert Blair via AccessMonster.com
- Re: Mail Merge Module fails to open Data Source
- From: Van T. Dinh
- Re: Mail Merge Module fails to open Data Source
- From: Robert Blair via AccessMonster.com
- Mail Merge Module fails to open Data Source
- Prev by Date: Invoice Creation / Subform
- Next by Date: Form / Subform Read Only after update?
- Previous by thread: Re: Mail Merge Module fails to open Data Source
- Next by thread: Re: Mail Merge Module fails to open Data Source
- Index(es):
Relevant Pages
|