Please see attached zip file containing a Word 2010 mail merge template and xlsx file containing the source data.
I would like to add another condition for strLetterType = "Nevada's Big Give" and have the result be the same as that for strLetterType = "Philanthropic Programs". Once I get the logic properly placed, I will add a sentence or two to the body of the letter for Nevada's Big Give records.
Can I just add an or condition to strLetterType = "Philanthropic Programs"? If not, how would I do this?
Thanks in advance.
Add Or Condition to Mail Merge
-
- 3StarLounger
- Posts: 390
- Joined: 26 Jan 2010, 16:02
- Location: Las Vegas, NV
Add Or Condition to Mail Merge
You do not have the required permissions to view the files attached to this post.
Carol W.
-
- Administrator
- Posts: 78536
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Add Or Condition to Mail Merge
I can't find a condition for strLetterType = "Philanthropic Programs" in the merge document...
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 390
- Joined: 26 Jan 2010, 16:02
- Location: Las Vegas, NV
Re: Add Or Condition to Mail Merge
I just double checked the file I sent. In the docx file, it's on page 8 of 9. See attached screenshot.
Did I mess up?
Did I mess up?
You do not have the required permissions to view the files attached to this post.
Carol W.
-
- Administrator
- Posts: 78536
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Add Or Condition to Mail Merge
Sorry, I missed that one.
Macropod will probably come up with a clever field code, but I don't know of one. I'd simply add another If field with the desired condition, and duplicate the text for Philanthropic Programs.
Macropod will probably come up with a clever field code, but I don't know of one. I'd simply add another If field with the desired condition, and duplicate the text for Philanthropic Programs.
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 390
- Joined: 26 Jan 2010, 16:02
- Location: Las Vegas, NV
Re: Add Or Condition to Mail Merge
I tried exactly what you suggest, namely adding another if field and changing the literal in the condition. However, I got tangled up in the brackets and the resulting merged document was blank.
Thanks for trying.
Thanks for trying.
Carol W.
-
- Administrator
- Posts: 78536
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Add Or Condition to Mail Merge
Here is the merge document with the added letter for Nevada's Big Give.
Please note that the document is currently disconnected from its data source, you'll have to select the recipients again.
Please note that the document is currently disconnected from its data source, you'll have to select the recipients again.
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans
Hans
-
- 3StarLounger
- Posts: 390
- Joined: 26 Jan 2010, 16:02
- Location: Las Vegas, NV
-
- 4StarLounger
- Posts: 508
- Joined: 17 Dec 2010, 03:14
Re: Add Or Condition to Mail Merge
You might like to try the attached revision. Basically, I've transferred the bulk of the common content to a few SET fields at the start of the document (they almost fill the first page if you do Alt-F9), using REF fields to pull in the data, as appropriate to what remain as a series of independent (rather than nested) fields. That should make for easier maintenance and more consistent formatting.
You do not have the required permissions to view the files attached to this post.
Paul Edstein
[Fmr MS MVP - Word]
[Fmr MS MVP - Word]
-
- 3StarLounger
- Posts: 390
- Joined: 26 Jan 2010, 16:02
- Location: Las Vegas, NV
Re: Add Or Condition to Mail Merge
Thanks, Paul. I probably should have done it this way in the first place.
I've implemented Hans' solution in production but I'm still trying to get your version of the template to work the way I want it to work. See attached screenshot for sample of letter (#1) that was generated.
Do I have to change the way I'm creating the Excel file to use your version?
I've implemented Hans' solution in production but I'm still trying to get your version of the template to work the way I want it to work. See attached screenshot for sample of letter (#1) that was generated.
Do I have to change the way I'm creating the Excel file to use your version?
You do not have the required permissions to view the files attached to this post.
Carol W.
-
- 4StarLounger
- Posts: 508
- Joined: 17 Dec 2010, 03:14
Re: Add Or Condition to Mail Merge
Hi Carol,
That image suggests you haven't actually executed the merge yet or that its for an undefined letter type. And no, you shouldn't need to change anything in your Excel file. If you upload a sample data file, I can test & confirm that the field code work as I'd expect.
That image suggests you haven't actually executed the merge yet or that its for an undefined letter type. And no, you shouldn't need to change anything in your Excel file. If you upload a sample data file, I can test & confirm that the field code work as I'd expect.
Paul Edstein
[Fmr MS MVP - Word]
[Fmr MS MVP - Word]
-
- 3StarLounger
- Posts: 390
- Joined: 26 Jan 2010, 16:02
- Location: Las Vegas, NV
Re: Add Or Condition to Mail Merge
Paul,
I did execute the merge. I've attached a zip file containing an xlsx file containing four records, all for strLetterType = "Nevada's Big Give".
Thanks!
I did execute the merge. I've attached a zip file containing an xlsx file containing four records, all for strLetterType = "Nevada's Big Give".
Thanks!
You do not have the required permissions to view the files attached to this post.
Carol W.
-
- 4StarLounger
- Posts: 508
- Joined: 17 Dec 2010, 03:14
Re: Add Or Condition to Mail Merge
See attached. Somehow I'd omitted "Nevada's Big Give"
You do not have the required permissions to view the files attached to this post.
Paul Edstein
[Fmr MS MVP - Word]
[Fmr MS MVP - Word]
-
- 3StarLounger
- Posts: 390
- Joined: 26 Jan 2010, 16:02
- Location: Las Vegas, NV