• insert sectionbreak on mailmerge test (97)

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » insert sectionbreak on mailmerge test (97)

    Author
    Topic
    #373198

    Hello All,

    A user in our firm wants to create the following situation:
    * We have a database with main companies and sub companies information
    * We want to use mailmerge to print information two sided
    * BUT if the main company changes it sould always start printing on a new paper
    (e.g. by changing to a sectionbreak even page)

    Question:
    Is it possible to check if the main company information changes and if so to force Word to print on the next paper?

    Thanks in advance.

    Viewing 0 reply threads
    Author
    Replies
    • #599023

      In theory what you are proposing should be possible, though Word isn’t terribly good at dealing with one-to-many relationships such as your main company with sub companies. It’s been some time since I did a merge that was printing two sided (in Access 97), but I believe Word will automatically take care of the section-break even page.

      I would also like to suggest an alternative of using OLE Automation to create the Word document on the fly – I presume your database is Access 97. If not, that wouldn’t work however. The advantage of the Automation approach is that you can easily deal with the one-to-many relationship, although it does involve writing some VBA. Hope this helps.

      • #599026

        Hello Wendel,

        Thanks for your reaction.
        The database looks something like this:

        | maincomp | subcomp | Adres | … |
        | 1 | 1 | … | … |
        | 1 | a | … | … |
        | 1 | b | … | … |
        | 2 | 2 | … | … |
        | 2 | a | … | … |

        So when printing information as long ‘maincomp’ is 1 all the information of sub ‘a’ en ‘b’ must be printing on two sided pages. If ‘maincomp’ and ‘subcomp’ are equal the record should not be printed but the next print MUST be on a new paper.

        I hope this will make any sense.

        • #599092

          I take it from your reply that you are working with a database – is the database Access?

          • #599142

            sorry Wendell,

            Yes it is Access 97.
            But the table used for the merge is a flat table

            • #599159

              Shucks – I was hoping you really had a main table with a linked table containing the subcompanies. In that case Access could do what you want with relative ease. Doing it in Word is a bit more of a challenge – you basically want to do a catalog style of merge where the entries follow one after another (much like a label merge), but you also want to embed an IF field to check to see whether the current entry has the characteristics of a main company, and if true, insert the sectionbreak even page field. In theory it should work. Good luck.

            • #599161

              You can probably do this with REF and SET fields. I got the idea from Cindy Meister’s tips for mail merge – see the item on avoiding duplicates.

              See the attached document. You can copy the field codes (make them visible with Alt+F9) and paste them into your own document. If you want to create the fields yourself, type Ctrl+F9 to insert a field. Don’t type the brackets { } yourself.

              It should look like this (with field codes displayed):
              { IF { REF PreviousComp } {MERGEFIELD MainComp } “===Section Break (Odd Page)====
              ” “” } { MERGEFIELD MainComp } {MERGEFIELD SubComp} … { SET PreviousComp { MERGEFIELD MainComp } }

              The idea is that the previous MainComp is stored by the SET field, and compared to the current MainComp in the IF field. If they are different, a section break (I think it should be an odd page break) is inserted, otherwise an empty string.

            • #599166

              Thanks Hans,

              I’m not sure if the section break will work this way…
              but I’ll give it to our programmer.

    Viewing 0 reply threads
    Reply To: insert sectionbreak on mailmerge test (97)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: