Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Bryan L
 
Posts: n/a
Default Hard returns in an If-Then-Else statement

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


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Charles Kenyon
 
Posts: n/a
Default Hard returns in an If-Then-Else statement

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

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!
--------- --------- --------- --------- --------- ---------
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.

"Bryan L" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Bryan L
 
Posts: n/a
Default Hard returns in an If-Then-Else statement

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

_______________
"Bryan L" wrote in message
...
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



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
REMOVE HARD CARRIAGE RETURNS IN A PARAGRAPH? Dwight Microsoft Word Help 2 October 14th 05 06:17 PM
REMOVE HARD CARRIAGE RETURNS IN A PARAGRAPH? Peter H Microsoft Word Help 0 October 14th 05 05:13 AM
place text in middle of page without hard returns houston Microsoft Word Help 2 September 12th 05 07:25 PM
Can I delete all hard returns in a document? auds Microsoft Word Help 1 April 19th 05 07:11 PM
How do I remove hard returns from text imported into Word? sjbcivil Page Layout 2 March 31st 05 01:45 PM


All times are GMT +1. The time now is 09:22 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"