Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Mar 2016
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Matching a Member In a List Using Mail Merge Field Code

    All,

    I have a field called "Cities" with four options: Atlanta, Baltimore, Charlotte, and Dallas. The user can select one or multiple cities. I want to place an "X" next to the matching city(ies) selected by the user. For example, if the user selects Atlanta and Dallas, the output of the mail merge should look like this:
    X Atlanta
    Baltimore
    Charlotte
    X Dallas
    The data source comes from one variable in a database. The variable collects the information from a Web interface. Users will open their browsers, fill-out the information; and if they want to print their selection, a professional mail merge is created with the information filled out. Unfortunately, I cannot change the data source. I've used combinations of the IF, OR, COMPARE functions but no luck. The closest I can get is something like:
    {IF {COMPARE = OR ("{MERGEFIELD Cities}")="Atlanta"}=1 "X" ""} - for the Atlanta row. When I run the mail merge to see the values selected by the user and do ALT+F9, it shows:
    IF {COMPARE = OR ("Atlanta, Dallas")="Atlanta"}=1 "X" ""} ......BUT no "X" is placed next to Atlanta. What am I doing wrong? Is there another way to accomplish the same? How can I match a member in a list using mail merge field code?
    Thank you in advance for your help.

  2. #2
    Star Lounger Graham Mayor's Avatar
    Join Date
    Mar 2016
    Location
    Cyprus
    Posts
    68
    Thanks
    0
    Thanked 24 Times in 24 Posts
    Sometimes the simplest approach is the best

    { IF { MERGEFIELD "Cities" } = "Atlanta" "X " }{ IF { MERGEFIELD "Cities" } = "Dallas" "X " }{ MERGEFIELD "Cities" }
    Graham Mayor - Word MVP
    http://www.gmayor.com

  3. #3
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts
    Cross-posted (and answered in full, before posting here) at: http://answers.microsoft.com/en-us/o...a-51349b65b25c
    Please read our policy on Cross-Posting in rule #14: http://windowssecrets.com/forums/faq...n#crossposting
    Cheers,

    Paul Edstein
    [MS MVP - Word]

  4. #4
    New Lounger
    Join Date
    Mar 2016
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Graham. I like to keep it simple too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •