Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Mail Merge

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-05-2019, 01:03 PM
Zenoman Zenoman is offline Windows 10 Office 2019
Novice
 
Join Date: Mar 2019
Posts: 6
Zenoman is on a distinguished road
Default Mail merge { IF {....

Greetings!
I'm fairly new to mail merge docs and have inherited a mess.
The mail merge works except for populating with department head names/titles and I can't seem to get it to work right.


What I'm looking for is something similar to this:
{ IF {MERGEFIELD DeputyDirector} persons name and title} { IF {MERGEFIELD AssistantDirector} persons name and title}{ IF { MERGEFIELD deputy director and assistant director} names and titles}

I may be over thinking it. I don't know. I do know about Ctrl+F9. I just need the right syntax and can't seem to get it right. Usually it comes back blank.
Reply With Quote
  #2  
Old 03-05-2019, 01:33 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,355
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

What are the actual field names in the data source? It seems unlikely you'll have three separate fields named 'DeputyDirector', 'AssistantDirector', and 'DeputyDirector and AssistantDirector' there.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #3  
Old 03-05-2019, 01:40 PM
Zenoman Zenoman is offline Windows 10 Office 2019
Novice
 
Join Date: Mar 2019
Posts: 6
Zenoman is on a distinguished road
Default

There are only two data fields. What I need is for the mail merge to do is populate if it is either one or the other or both. So Deputy director or assistant director or deputy director and assistant director. I need it to: if deputy director then deputy director+name or if assistant director then assistant director+name or if deputy director and assistant director then both+name.
Reply With Quote
  #4  
Old 03-05-2019, 01:42 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,355
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

You still have said what the field names in the data source are...
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #5  
Old 03-05-2019, 01:48 PM
Zenoman Zenoman is offline Windows 10 Office 2019
Novice
 
Join Date: Mar 2019
Posts: 6
Zenoman is on a distinguished road
Default

Sorry, thought I did. It's:
ProcessFields_AssistantDirectorApproval
ProcessFields_DeputyDirectorInfrastructureProgramm ingApproval

It's pulling from an online database that we don't manage in-house.
Reply With Quote
  #6  
Old 03-05-2019, 02:01 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,355
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

You could use a field construction like:
Code:
{IF«ProcessFields_AssistantDirectorApproval»<> "" "Assistant Director text{IF«ProcessFields_DeputyDirectorInfrastructureProgrammingApproval»<> "" " and "}}{IF«ProcessFields_DeputyDirectorInfrastructureProgrammingApproval»<> "" "Deputy Director Infrastructure Programming text"}
Note: The field brace pairs (i.e. '{ }') for the above example are all created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac or, if you’re using a laptop, you might need to use Ctrl-Fn-F9); you can't simply type them or copy & paste them from this message. Nor is it practical to add them via any of the standard Word dialogues. Likewise, the chevrons (i.e. '« »') are part of the actual mergefields - which you can insert from the 'Insert Merge Field' dropdown (i.e. you can't type or copy & paste them from this message, either). The spaces represented in the field constructions are all required.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #7  
Old 03-05-2019, 02:08 PM
Zenoman Zenoman is offline Windows 10 Office 2019
Novice
 
Join Date: Mar 2019
Posts: 6
Zenoman is on a distinguished road
Default

Okay, I'll give it a run through and see what I get. Thank you for your assistance, it's greatly appreciated.
Reply With Quote
  #8  
Old 03-05-2019, 03:20 PM
Zenoman Zenoman is offline Windows 10 Office 2019
Novice
 
Join Date: Mar 2019
Posts: 6
Zenoman is on a distinguished road
Default

Okay, I've given it a few tries and can't seem to get it to populate correctly.
Either it comes up blank, which means I didn't do it correctly, or it shows "Assistant Director name and" without the quotes.
Reply With Quote
  #9  
Old 03-05-2019, 03:25 PM
Zenoman Zenoman is offline Windows 10 Office 2019
Novice
 
Join Date: Mar 2019
Posts: 6
Zenoman is on a distinguished road
Default

This is exactly what I've got in the field:
{IF«ProcessFields_AssistantDirectorApproval»<> "" "Assistant Director Khalid Bazmi{IF«ProcessFields_DeputyDirectorInfrastructur eProgramming»<> "" " and "}}{IF«ProcessFields_DeputyDirectorInfrastructureP rogramming<> "" "Deputy Director Infrastructure Programming Nardy Khan"}

Is there a way to add a return line between the two also?

Last edited by Zenoman; 03-05-2019 at 04:01 PM. Reason: Question
Reply With Quote
  #10  
Old 03-05-2019, 04:18 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,355
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

You can have pretty much whatever content you want. For example, where I've shown " and ", you might replace either or both spaces with line breaks or paragraph breaks.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update & Unlink Specific Merge Field in Word Doc from Mail Merge - Excel VBA RMerckling Mail Merge 16 05-17-2018 05:19 PM
How do I mail merge records into table columns with more than one merge field? tech123 Mail Merge 1 04-26-2017 07:13 PM
Mail Merge is Deleting objects in my header and footer during the merge bgranzow Mail Merge 9 06-05-2015 05:03 AM
Mail merge how to link mail merge field value to a column heading dsummers Mail Merge 1 05-08-2014 02:59 PM
Saving INDV mail merges During the mail merge sedain121 Mail Merge 2 10-04-2011 07:52 PM


All times are GMT -7. The time now is 10:16 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft