Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / November 2005

Tip: Looking for answers? Try searching our database.

Hard returns in an If-Then-Else statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bryan L - 30 Nov 2005 17:18 GMT
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
Charles Kenyon - 30 Nov 2005 18:04 GMT
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 }

Signature

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.

> 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
[quoted text clipped - 29 lines]
>
> Bryan
Bryan L - 30 Nov 2005 20:29 GMT
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

_______________
> 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
[quoted text clipped - 29 lines]
>
> Bryan

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.