Conditional Merge with Tables.

A

Andrew Minor

Hi,

I'm using Word 2000 and I'm trying to work out how to do a merge
whereby a table is printed dependant on a condition. The pseudo-code
is:

If (Mergefield(a) = "BACS") or (Mergefield(a) = "") then

----------------------------------
| Table goes here |
|--------------------------------|
| multiple rows |
|--------------------------------|
| |
----------------------------------

Else

' Print nothing at all, not even a blank line.

End If

The "If..Then..Else" Word merge field doesn't seem to help as I can't
paste formatted text into the relevant places in the dialog box.

I'm sure I was able to do this in WP5.1 for DOS so I MUST be able to
do this in Word 2000. Am I missing something particularly obvious?

Can anyone advise?

Thanks

Andrew Minor
 
P

Peter Jamieson

The "If..Then..Else" Word merge field doesn't seem to help as I can't
paste formatted text into the relevant places in the dialog box.

Don't try to paste formatted text into the dialog box. Make sure you are in
the view where you can see the field codes, e.g.

{ IF { MERGEFIELD a } = "BACS"
""
""
}

then paste the table cells directly between the relevant quotes. You will
not be able to avoid having extra paragraphs around the table, but when the
result is "" you should not have any extra lines at all.

If you really need IF a = "BACS" or a = "", you can't use an "or" in the IF
field in the way you have shown. You can do it using a bit more nesting,
e.g.

{ IF { ={ COMPARE "{ MERGEFIELD a }" = "BACS" }+{ COMPARE "{ MERGEFIELD a }"
= "" } } > 0 "put your table here" "" }
I'm sure I was able to do this in WP5.1 for DOS so I MUST be able to
do this in Word 2000.

In the general case, that ain't necessarily so, although I believe you
should be able to do what you want in this case.
Am I missing something particularly obvious?

I don't think so.

Peter Jamieson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top