Thread: [Solved] IF Statement not working
View Single Post
 
Old 02-27-2020, 02:54 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
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

Quote:
Originally Posted by shawn.low@cox.net View Post
I added this simple code.


{IF {MERGREFIELD TableStart:BorrowerProductQuery \*MERGEFORMAT}{MERGEFIELD Selected_Product_Frequency \*MERGEFORMAT}{MERGEFIELD TableEnd:BorrowerProductQuery \*MERGEFORMAT } = "Bi-Weekly" "" "Hello" }
If you wanted to have 'Hello' between the two tables when the frequency is Bi-Weekly, you use only:
{IF{MERGEFIELD Selected_Product_Frequency}= "Bi-Weekly" "Hello"}
between those two tables. As it is, you have an IF test that incorporates the whole 'BorrowerProductQuery' table as part of the condition being tested against 'Bi-Weekly'. That'll never fly.
Quote:
Originally Posted by shawn.low@cox.net View Post
I know you don't think the MERGEFIELD and MERGEFORMAT aren't needed, but Word adds these, I don't. I use the >Insert > Quick Parts > Field > MergeField
I type in the name of the field in the "Field Name" field. Then click "ok"
I actually said only that the \* MERGEFORMAT switch is unnecessary. The MERGEFIELD designation is most definitely required. You're getting the \* MERGEFORMAT switches because you're leaving the 'Preserve formatting during updates' option checked when you insert the fields. Word will also add them (rather unhelpfully) if you reformat the fields after inserting them.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote