Results 1 to 2 of 2
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Morden, Surrey, United Kingdom
    Posts
    1,838
    Thanks
    3
    Thanked 0 Times in 0 Posts

    If Mergefields (WinNT4, Word97)

    Does anybody know if it is possible to refer to a specific mergefield in the NEXT record?

    I have an XL list of customers, some of whom have more than one account (the records are by account, so I have several records for a customer with more than one account), and I need to send one letter to each customer, referring to all his/her accounts. I had no problem filtering the fields so only one letter is created for each customer (extra field, if reference is same as above reference then true, if not blank - filter so letters go to blanks only) and I know how to do the if field so that it creates a line for the account only if there is an account there, but I don't know how (or if it's possible) to tell it, basically, if the 'Multiples' field in the next record is 'True', put in a new line etc, if not don't.

    Any help would be gratefully appreciated!

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Beryl M


  2. #2
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: If Mergefields (WinNT4, Word97)

    Hi Beryl:
    Yes, you can do this. I copied the following tip from someone & then annotated it. I believe it was from Cindy Meister's website at http://homepage.swissonline.net/cind...r/MergFram.htm. You can use a combination of SET and IF fields in the main merge document to check for duplicate information and suppress merge fields for a record if they are the same as in the previously merged record. As for the other merge types, here you also need to pre-sort the records before merging.

    Example: { IF { REF Check } <> "{ MERGEFIELD FIRSTNAME } { MERGEFIELD LASTNAME }"
    "{ MERGEFIELD FIRSTNAME } { MERGEFIELD LASTNAME }
    { MERGEFIELD ADDRESS }
    { MERGEFIELD CITY }" }
    { SET Check "{ MERGEFIELD FIRSTNAME } { MERGEFIELD LASTNAME }"}

    Note how this works. It inserts the first record because, by definition, the first record cannot yet be a duplicate. It then creates a bookmark by the name of Check,{SET Check " "}etc.. It holds this as a variable & then assigns a value to it. The value is contained between the double quotes. Here, the value (result) will be the "{Mergefield FirstName} {Mergefield LastName}" that was just inserted.

    Next, the { IF { REF Check } examines this value & asks if it's not equal to (<>) the next {Mergefield FirstName} {Mergefield LastName}. Notice that while it appears to examine itself,

    i.e. is { MERGEFIELD FIRSTNAME } { MERGEFIELD LASTNAME } <> { MERGEFIELD FIRSTNAME } { MERGEFIELD LASTNAME }

    it really compares the results of the current field, to the next one merged. If they are not the same, it puts in the name, address, & city, each on its own line (that's where the marks come in). If they are the same, it inserts nothing. (While not shown, you could have a space & pair of double quotes after the double quotes which follows the {Mergefield City}.)

    I do notice that each time the SET field is inserted & then deleted, it leaves behind a paragraph mark. This marks the number of duplicates it has skipped, which may or may not be useful.

Posting Permissions

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