Hard returns in an If-Then-Else statement

B

Bryan L

I've set up a table in Word that uses merge fields to pull customer
information from our SQL DB application. All customers have a FirmName
entered but only some customers have a DBA entered. For customers where a
DBA exists, I want to prepend "DBA: " to the DBA field, and this is in fact
working just fine. However, I want the DBA to appear below the FirmName,
and I haven't figured out how to accomplish this in a table. Right now,
here's how things appear in the cell:

TLC Properties, LLC / DBA: Miller Hotels

Here's how I want things to appear:

TLC Properties
DBA: Miller Hotels

When working outside a table, I know it's a simple matter for Word to remove
the extra hard returns when a particular merge field is blank so no blank
lines are left where the merge field placeholder was. But I can't figure
out how to make that work within a single cell in a table. Here's what my
merge fields look like in that cell:

{MERGEFIELD ToFirmName} { IF {MERGEFIELD ToDBA }<> "" "/ DBA:" "" } {
MERGEFIELD ToDBA }

So specifically, I need to figure out how to add a hard return in front of
the "DBA:" conditional text when the DBA field is not blank. I'm trying to
avoid wasted space, which is why I'm not simply creating a separate cell for
the DBA field. I don't want it to sit there empty when there's no DBA for
that customer.

Hope this makes sense; any help appreciated.

Bryan
 
C

Charles Kenyon

Put the hard return into your conditional text. Note that this is a
paragraph mark and contains all sorts of formatting information. You may
want to use a line break instead (Shift-Enter instead of Ctrl-Enter).

{MERGEFIELD ToFirmName} { IF {MERGEFIELD ToDBA }<> "" "
DBA:" } {
MERGEFIELD ToDBA }

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
B

Bryan L

Heh, never mind; as it turns out, Word DOES treat hard returns and merge
fields within a table cell the same way it does in the main document.
Entering my hard return AFTER the FirmName took me one line below, and there
I set up my conditional merge field and DBA merge fields. It works
perfectly. For customers that have no DBA entered, the Firmname appears in
a cell just one line high. For customers that do have a DBA, the Firm name
appears on line one and the DBA appears on line two; all of that apears in a
cell that's two lines high.

I kinda like Word better now.

Thanks

Bryan

_______________
 

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