Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
REMOVE HARD CARRIAGE RETURNS IN A PARAGRAPH? | Microsoft Word Help | |||
REMOVE HARD CARRIAGE RETURNS IN A PARAGRAPH? | Microsoft Word Help | |||
place text in middle of page without hard returns | Microsoft Word Help | |||
Can I delete all hard returns in a document? | Microsoft Word Help | |||
How do I remove hard returns from text imported into Word? | Page Layout |