none
How to check a checkbox based on a condition mergefield RRS feed

  • Question

  • Hi guys and girls,

    I am quite new to using mergefields and developing on word for that matter, so bear with me.

    Currently I have a document already layed out, and on it has some {FORMCHECKBOX} fields and I want to check this box based on some condition, something along the lines of

    {IF {DOCVARIABLE "TEST"*\ MERGEFORMAT} = "True" "[check the checkbox]" "[don't check checkbox]"}.

    I was wondering if there was a way to do this?

    Not sure if it matters but probably does, I am doing this on Word 2010.



    • Edited by DorkMonstuhh Tuesday, April 21, 2015 5:49 PM Added version of word used.
    Tuesday, April 21, 2015 5:44 PM

All replies

  • Hi,

    My understanding is that you want to use "mergefields" and monitor the state of Checkbox control. For example, if the checkbox is checked, the filed will return "True". Am I right? If yes, as far as I know, the "mergefields" has no build-in property to do such things. Hope other communicators give you some lights.

    Regards,

    George

    Thursday, April 23, 2015 6:32 AM
  • Hi Dork

    One very basic problem with your approach is that Form checkboxes are removed from your document upon execution of the mail merge...

    What you could do is keep the basic approach of using an IF field. Have the IF field test the Mergefield value and display a SYMBOL (as in Insert/Symbol) appropriate to it.


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, May 21, 2015 5:43 PM
    Moderator
  • Although your post refers to using mergefields, there are none in the example you gave - only IF, DOCVARIABLE and FORMCHECKBOX fields. So, perhaps, you're using the wrong terminology.

    That said, if you want to show a textbox character as checked or unchecked depending on the state of a DOCVARIABLE, you could use a field coded along the lines of:
    {SYMBOL {IF{DOCVARIABLE "TEST" \* Upper} = "TRUE" 254 168} \a \f Wingdings}

    If you are indeed using a mailmerge & mergefields, you could use a field coded along the lines of:
    {SYMBOL {IF{MERGEFIELD CheckState \* Upper}= "TRUE" 254 168} \a \f Wingdings}


    Cheers
    Paul Edstein
    [MS MVP - Word]

    Sunday, June 7, 2015 10:38 AM