|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Word 2013 mail merge directory conditional printing city if value changes
Hello All. To put it simply, I need to create a directory of our offices. I have already created a successful mail merge of the data and it looks pretty good. Now I need to fine tune it. What I want to do is to print the city to the far left if it is a different city and nothing if it is the same city.
My merge works just fine and indenting / formatting shouldn't be a problem for me, I just need to know how to print the city if different from the last one, else skip it. Here is a short example of what I am looking for. The Bold Underline field is { MERGEFIELD Address_City } and is the key field for this. The display below is sort of what the output should be, although I shortened it up for the post. DIRECTORY Atascosa Company Address Atascosa, TX zip Company 2 Address Atascosa, TX zip San Antonio Company 3 Address San Antonio, TX zip Company 4 Address San Antonio, TX zip Company 5 Address San Antonio, TX zip Company 6 Address San Antonio, TX zip Von Ormy Company 7 Address Von Ormy, TX zip Thank you in advance for your help |
#2
|
||||
|
||||
You can use Word's Catalogue/Directory Mailmerge facility for this (the terminology depends on the Word version). To see how to do so with any mailmerge data source supported by Word, check out my Microsoft Word Catalogue/Directory Mailmerge Tutorial:
https://www.msofficeforums.com/mail-...-tutorial.html The tutorial covers everything from list creation to the insertion & calculation of values in multi-record tables in letters. Do read the tutorial before trying to use the mailmerge document included with it. Depending on what you're trying to achieve, the field coding for this can be complex. However, since the tutorial document includes working field codes for all of its examples, most of the hard work has already been done for you - you should be able to do little more than copy/paste the relevant field codes into your own mailmerge main document, substitute/insert your own field names and adjust the formatting to get the results you desire. For some worked examples, see the attachments to the posts at: https://www.msofficeforums.com/mail-...html#post23345 https://www.msofficeforums.com/mail-...html#post30327 Another option would be to use a DATABASE field in a normal ‘letter’ mailmerge main document and a macro to drive the process. An example of this approach can be found at: Many to one email merge using tables - Microsoft Community Conversely, if your workbook has a separate sheet with just a single instance of each of the grouping criteria, a DATABASE field in a normal ‘letter’ mailmerge main document could be used without the need for a macro. For an example of that, see: Mail Merge - To a Word Table on a Single Page - Microsoft Community The DATABASE field can even be used without recourse to a mailmerge. An example of such usage can be found at: https://www.msofficeforums.com/mail-...html#post67097 Alternatively, you may want to try one of the Many-to-One Mail Merge add-ins, from: Graham Mayor at Merge Many To One or Doug Robbins at http://bit.ly/1hduSCB
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
I guess I need to be more specific. I am only after one thing. I have this in a word booklet docx (properly formatted, of course) with a SQL Server data source, which works just fine for quite a few pages.
DIRECTORY Company Address Atascosa, TX zip Company 2 Address Atascosa, TX zip Company 3 Address San Antonio, TX zip Company 4 Address San Antonio, TX zip Company 5 Address San Antonio, TX zip Company 6 Address San Antonio, TX zip Company 727 Address Von Ormy, TX zip. The problem is, that I need to add the city name to the left (as indicated) if it is first time for the city or is different from the previous city. Here is what the output should look like: Atascosa Company Address Atascosa, TX zip Company 2 Address Atascosa, TX zip San Antonio Company 3 Address San Antonio, TX zip Company 4 Address San Antonio, TX zip Company 5 Address San Antonio, TX zip Company 6 Address San Antonio, TX zip Von Ormy Company 727 Address Von Ormy, TX zip. I have tried a few iterations but the merge came out incomplete or gave different results. Which is based on your tutorial. I guess the other items you have in it, along with the different naming conventions and other problems you addressed just doesn't address this simple item. I forgot to mention that I am a programmer, asp and .net, formerly cobol, natural 2, jcl. But WordMerge (What is the language?) is a little confusing for me, primarily because I don't understand the syntax. If you could answer my question here, it will really help with the rest of it. I just need to understand the syntax as it applies here in this part, leaving out all the rest. Just how to make the City work. Understanding this part will go a long way to helping me with the rest of it. Thanks for responding. I hope you will again. |
#4
|
||||
|
||||
The method described in the tutorial is perfectly capable of producing the output you require - there is nothing to prevent the City name appearing as both a heading and in the entries for that city (assuming your data source has a separate field for the City name). The first and second of the DATABASE field approaches can do likewise. If the address and city are in the same field, there's nothing a mailmerge can do to generate the desired output.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
OK. I guess I will have to wade through the expansive tutorial and figure out the answer for myself. Thank you for your response.
|
#6
|
|||
|
|||
I have found the answer I was looking for.
Have a good day. |
Tags |
directory, mail merge, word 2013 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Creating a directory merge (Office 2013) | blackystrat | Word | 1 | 09-10-2016 04:03 AM |
Directory Mail Merge | IslandAC | Mail Merge | 1 | 09-09-2016 04:53 PM |
Word 2010 - directory mail merge - two separate group of data in one document | htsu | Mail Merge | 2 | 03-07-2016 03:10 PM |
Directory Mail Merge Issues | dbpros_crm | Mail Merge | 10 | 01-20-2014 11:05 PM |
mail merge treating CITY as DATE | woody | Mail Merge | 6 | 01-30-2013 03:22 PM |