Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-03-2018, 08:23 AM
KurtWoodfin KurtWoodfin is offline Age Range and An Extra } is Appearing Windows 8 Age Range and An Extra } is Appearing Office 2010 64bit
Novice
Age Range and An Extra } is Appearing
 
Join Date: Apr 2018
Posts: 2
KurtWoodfin is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 04-03-2018, 03:19 PM
macropod's Avatar
macropod macropod is offline Age Range and An Extra } is Appearing Windows 7 64bit Age Range and An Extra } is Appearing Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 04-04-2018, 02:47 PM
KurtWoodfin KurtWoodfin is offline Age Range and An Extra } is Appearing Windows 8 Age Range and An Extra } is Appearing Office 2010 64bit
Novice
Age Range and An Extra } is Appearing
 
Join Date: Apr 2018
Posts: 2
KurtWoodfin is on a distinguished road
Default 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
Reply With Quote
  #4  
Old 04-04-2018, 02:53 PM
macropod's Avatar
macropod macropod is offline Age Range and An Extra } is Appearing Windows 7 64bit Age Range and An Extra } is Appearing Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

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
Age Range and An Extra } is Appearing Find if Date range falls within another range Triadragon Excel 3 05-02-2016 11:48 AM
Age Range and An Extra } is Appearing 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

Other Forums: Access Forums

All times are GMT -7. The time now is 04:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft