#1
|
|||
|
|||
Age Range and An Extra } is Appearing
I am trying to deal with a range of age in a mail merge. Specifically, I want "Juvenile, " to appear on our subpoenas, if the person being subpoenaed is between the ages of 0 and 18. I have to include zero because some date of births are blank. I wrote the following code in the mail merge. Everything works, expect it throws a { in front of the people who are note juveniles. The extra bracket in the title is facing the wrong way. It should be facing {.
{ Mergefield TableStart_Case } { Mergefield "TableStart_Witnesses" } { IF { Mergefield "Wtns_age" } > 0 "Juvenile" { IF {Mergefield "Wtns_age" } < 18 "Juvenile"}} {Mergefield "TableEnd_Witnesses" } {Mergefield "TableEnd_Case"} I tried removing the second bracket after the second “Juvenile”, but that did not fix the problem. I still get the bracket. Any help is appreciated. Thank you Kurt |
#2
|
||||
|
||||
If you're getting { in the output, that would only be because someone typed the { instead of using Ctrl-F9 to create a field brace pair (i.e. { }). As for your field construction, it should be:
{IF{MERGEFIELD "Wtns_age"}> 0 {IF{MERGEFIELD "Wtns_age"}< 18 "Juvenile"}} As you have coded it, if the fields had been created properly, the output would be 'Juvenile' regardless of age.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
One More Question About Displaying the Age
Your code worked great for me! Thanks for your help. Also, I did not know about the F9 thing, which was also a great help. I do have one more questions. If the person is a juvenile, I would like for the code to display the age. Ideally, it will be displayed as (2), but I would be happy with just 2. Two in the example is the age. Thanks again for any help!
Kurt |
#4
|
||||
|
||||
That's as simple as:
{IF{MERGEFIELD "Wtns_age"}> 0 {IF{MERGEFIELD "Wtns_age"}< 18 "Juvenile ({MERGEFIELD "Wtns_age"})"}}
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Distribute text in one cell across a range of cells (overcoming selection.range.cells.count bug) | slaycock | Word VBA | 0 | 02-18-2017 07:00 AM |
Find if Date range falls within another range | Triadragon | Excel | 3 | 05-02-2016 11:48 AM |
Name a Range in a Word Document and then copy that range to the end of the doc w button click | DanNatCorning | Word VBA | 1 | 04-29-2016 10:47 PM |
Copying text range of cells to different cells adds an extra line | jpb103 | Word VBA | 2 | 07-23-2014 12:22 PM |
extra space before equation | Nice2007 | Word | 1 | 04-27-2012 05:05 PM |