[mso] Conditionally Insert a Word table in a Merge document
- From: larryspcremedies@xxxxxxx
- To: mso@xxxxxxxxxxxxx
- Date: Thu, 11 Sep 2008 14:17:44 -0400
Hi Guys,
I am developing a Mail Merge document that uses a table named
BaseTable from an Access DB named Base.mdb. One of the fields in BaseTable is
named Zip which contains a zip code.
I would like to conditionally insert a table using the {DATABASE ...
} field in the merge document based upon the contents of the Zip code field
found in BaseTable. The database being used in the {DATABASE ...}Â field
is called Secondary.mdb (i.e., it is an entirely different DB from the Merge
documents source DB).
I've created the following {if ... }Â statement in the merge document
{ IF {MERGEFIELD Zip } = 07092 { DATABASE \d "C:\\Documents and
Settings\\Me\\My Documents\\Secondary.mdb" \s "SELECT Name, Date FROM Table1
WHERE Date > #09/02/2008#" \h } "No Data" \*MERGEFORMAT }
When the Zip code field does not match 07092, I get the expected "No Data"
indication. However, when the zip code does match 07092, absolutely nothing is
displayed.
I have exhausted all my thoughts on how to get the table conditionally
inserted ... to no avail.
I also tried using the same DB for both the Merge document boiler plate and the
conditional merge document table (using different DBÂ tables, of course)Â ...
same results.
If I insert a table using the dialog for { DATABASE ... }, a table is
created ... but it's an unconditionally inserted table and doesn't toggle as a
field code.
If I insert the { DATABASE ... } as a field in the document, the result is "Err
or! Cannot open data source." This obviously is the reason why nothing is being
displayed with the {IF ...} statement, but I can't fathom why it won't open the
source.
Has anyone ever tried to conditionally insert a table in a merge document? If
so, I'd appreciate your suggestions.
Your input is appreciated
Larry
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or
MicrosoftOffice@xxxxxxxxxxxxxxxx
To send mail to the group, simply address it to mso@xxxxxxxxxxxxx
To Unsubscribe from this group, visit the group's homepage and use the dropdown
menu at the top. This will allow you to unsubscribe your email address or
change your email settings to digest or vacation (no mail).
http://www.freelists.org/webpage/mso
To be able to share files with the group, you must join our Yahoo sister group.
This group will not allow for posting of emails, but will allow you to join
and share problem files, templates, etc.:
http://tech.groups.yahoo.com/group/MicrosoftOffice . This group is for FILE
SHARING ONLY.
If you are using Outlook and you see a lot of unnecessary code in your email
messages, read these instructions that explain why and how to fix it:
http://personal-computer-tutor.com/abc3/v28/greg28.htm
*************************************************************
Other related posts:
- » [mso] Conditionally Insert a Word table in a Merge document