Microsoft Word Mergefields and Checkboxes

Hello Everyone,

I am setting up an automated contract word template which will be uploaded to a cloud-based CRM and will be using MERGEFIELDS in order to fill the form.

My problem is with automating checkboxes.

Right now this what Im doing:

In the word template I press Ctrl+F9 and put this line of code inside the brackets.

IF {<< Matter.CustomField.TorF >>}=-1 "Checked" "Unchecked"

 or 

IF {<< Matter.CustomField.TorF >>}=True "Checked" "Unchecked"

The problem is they both return the first value, Checked, weather the value for << Matter.CustomField.TorF >>  is True or False.

Can anyone tell me what Im doing wrong?

In VBA true is evaluated as -1 so I am not surprised that both return the true result. Have you tried 

IF {<< Matter.CustomField.TorF >>}=False "Checked" "Unchecked"

Andrew Lockton
Melbourne Australia

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

You appear to be missing an essential space after the '=' sign! You should have:{IF«Matter.CustomField.TorF»= -1 "Checked" "Unchecked"}
or:

{IF«Matter.CustomField.TorF»= 1 "Checked" "Unchecked"}
or:
{IF«Matter.CustomField.TorF»= TRUE "Checked" "Unchecked"}

depending on what «Matter.CustomField.TorF» actually outputs on its own.

Cheers
Paul Edstein
(Fmr MS MVP - Word)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

1. There are at least two possible problems here. One is the way that you have inserted your merge field. The other is the possible values that it can have. Starting with the latter...

2. What is the data source, and what is stored in the Matter.CustomField.TorF column for the True/False values?

3. Insert the mergefield directly into your document (e.g. from the dropdown list in the Mailings tab). You may see something like

{ MERGEFIELD "Matter.CustomField.TorF" } or

<<thefieldname>>

depending on the view.

4. Preview the data and see what the actual "True" and "False" values displayed in Word are. They may be different from what you see in the data source.

5. Adjust the IF field accordingly - each pair of { } are the special field code braces that you can insert using ctrl-F9 on Windows Word

e.g. you may need

{ IF "{ MERGEFIELD "Matter.CustomField.TorF" }" = "True" "the true value" "the false value" }

At the moment I would guess that the inner pair of { } are the ordinary braces you can type on the keyboard, not the ones you can insert using F9. 


[If the data source has stored True/False as the string values "T" and "F" then you need to make the comparison with "T" and "F"., e.g.

{ IF "{ MERGEFIELD "Matter.CustomField.TorF" }" = "T" "the true value" "the false value" }

Or if it could be T, t, F or f you could use

{ IF "{ MERGEFIELD "Matter.CustomField.TorF" \*Upper }" = "T" "the true value" "the false value" }

If the value comes from a column which has been defined or formatted as "boolean" in Access or Excel then the values can come across in several different ways, depending on the way that Word connects to the data. By default, Word now uses OLE DB, in which case Word will probably see "True" or "False" (not "TRUE" or "true" etc.). Via DDE it will probably see TRUE or FALSE. Via the older ODBC method, it will see1 for true and 0 for false. The textual values may be locale-dependent, e.g. WAHR/FALSCH on a German-language system using DDE.]

Field names such as "Matter.CustomField.TorF" are often an indication that some third-party software is actually being used to perform the merge instead of Word's builtin Mergefield process, in which case things may be even more complicated.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated August 1, 2022 Views 2,153 Applies to: