Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jan 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IF THEN ELSE - Multiple IF statments in 1 go - WORD 2000

    Hi

    Im currently creating a mail merge letter

    {IF {MERGEFIELD"BERREASON"}="P""{INCLUDETEXT "C:\\SAMBER"\*MERGEFORMAT}" "" {IF {MERGEFIELD"BERREASON"}="L""{INCLUDETEXT "C:\\SAMLIQUID"\*MERGEFORMAT}" "" {IF {MERGEFIELD"BLACKLIST"}="Y""{INCLUDETEXT "C:\\SAMBLACK"\*MERGEFORMAT}" ""}}}

    I merged the IF's because the mail merge was doing the first IF fine then producing the second and Third IF no matter what the outcome.

    I originally had:

    {IF {MERGEFIELD"BERREASON"}="P""{INCLUDETEXT "C:\\SAMBER"\*MERGEFORMAT}" ""}
    {IF {MERGEFIELD"BERREASON"}="L""{INCLUDETEXT "C:\\SAMLIQUID"\*MERGEFORMAT}" ""}
    {IF {MERGEFIELD"BLACKLIST"}="Y""{INCLUDETEXT "C:\\SAMBLACK"\*MERGEFORMAT}" ""}

    And this didn't work.

    Any advice would be helpful as its meant to bring back BLANK if none of the conditions are met.

  2. #2
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,162
    Thanks
    47
    Thanked 976 Times in 906 Posts
    I'm not conversant in Word 2000 mail merge, but the IF statements don't look right to me. I would expect a comma or other separator to delimit the statement steps.
    Something like:
    {IF {MERGEFIELD"BERREASON"}="P","{INCLUDETEXT "C:\\SAMBER"\*MERGEFORMAT}",""}

    Using this format you should be able to merge the IF statements much as you have, but with the delimiters in place.

    If the statements are correct then I suspect you need to use the IF statements in place of the blank field ("").
    Something like:
    {IF {MERGEFIELD"BERREASON"}="P" "{INCLUDETEXT "C:\\SAMBER"\*MERGEFORMAT}" {IF {MERGEFIELD"BERREASON"}="L" "{INCLUDETEXT "C:\\SAMLIQUID"\*MERGEFORMAT}" {IF {MERGEFIELD"BLACKLIST"}="Y" "{INCLUDETEXT "C:\\SAMBLACK"\*MERGEFORMAT}" ""}}}

    cheers, Paul

  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
    Rossybear: your field codes are missing some required spaces, the filenames are missing their extensions and you don't need the '\*MERGEFORMAT' switches. For example:
    {IF{MERGEFIELD"BERREASON"}= "P" "{INCLUDETEXT "C:\\SAMBER.DOC"}"}
    {IF{MERGEFIELD"BERREASON"}= "L" "{INCLUDETEXT "C:\\SAMLIQUID.DOC"}"}
    {IF{MERGEFIELD"BLACKLIST"}= "Y" "{INCLUDETEXT "C:\\SAMBLACK.DOC"}"}

    If you nest the fields, the second option will only be evaluated if the first option is negative and the third option will only be evaluated if the first and second options are both negative.

    Paul T: Word IF fields don't use comma separators.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Tags for this Thread

Posting Permissions

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