• Passing a value to the next Mail Merge record

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Passing a value to the next Mail Merge record


    I’m trying to use Word’s Mail Merge functionality to automatically construct a document from a data source. Conceptually, it’s a lot like designing a Report in Access. (For anyone interested, it’s actually a D&D spellbook, reordered in 1st Edition style.)

    A lot of things are quite doable, using the “Directory” layout. But I’m struggling to get some conditional functionality working.

    Conditional Heading

    The main thing is, I want some records to be preceded by a heading, based on the fact that a merge field’s value (the spell level) has incremented from one record to the next. Essentially, I’m trying to pass information from one record to the next.

    Initially, I tried creating a bookmark that is compared to the new value of the merge field, before being set to that value. Obviously, this could generate an error in the first field (since it hasn’t been set yet), but in fact it just doesn’t seem to work at all — at least, not in the merge simulation. It’s possible that’s because I need to put it at the start of the merge template (for testing reasons, I put it at the end). Running the real Merge, the match always fails, probably indicating that the bookmark does not retain its value between records.

    Is there a way to get this working?

    Obviously, the fall-back option is to modify the data. That seems inelegant, but probably necessary.

    Blank Lines Interacting with Styles

    The other issue is a bit weird. Some of the merge fields can be blank; some of these need to appear on their own line, but only if they contain data (spell duration, etc). I’ve tried both obvious techniques, but they’re a little inconsistent:  ending a paragraph inside an IF field, and putting the paragraph mark inside the merge field’s \f switch.

    Because I want to control the style of each line independently, the merge field (or IF field) has two different styles: one before and one after the embedded paragraph mark. Sometimes this works fine, but sometimes I get a very small, blank line, or weird paragraph spacing.

    Is there a better way to do this? Or any tips that might get me more consistent behaviour?

    (Incidentally, what I’ve described is really only possible by showing all field codes using Alt-F9 — in case you were wondering.)


    Thanks in advance for any help! 🙂

    Viewing 2 reply threads
    Viewing 2 reply threads
    Reply To: Passing a value to the next Mail Merge record

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

    Your information: