Populate Word Merge Check Box from exported txt file data (0 vs. 1)

Posted on 2007-10-18
Last Modified: 2008-01-09
I'm using an Access form to collect data for a MS Word Mail Merge document.  In addition to name and address fields, the Access form collects data for several Check Boxes.  I export the Access data to a comma delimited text file that the Word document references.  My question is how I get Check Box fields on the Mail Merge document to either populate or not-populate based on the 0 or 1 that is in the exported text file.  So, if the txt file for the first record has a 1 in the appropriate field I want a filled in Check-Box on the letter, vs. a blank Check Box.

I've exhausted the obvious options in Word help, and can't believe that there isn't a way to do this.  Any help/thoughts/ideas would be greatly appreciated.  All else fails, I suppose I can change the Access database to export a literal "X" to the text file.  I'd rather have the nice Check Box Form field available in Word though.

Thanks for your time.
Question by:bdbud
    LVL 76

    Expert Comment

    To set a checkbox on:

    AvtiveDocument.FormFields("Check1").CheckBox.Value = True

    'Off' is, of course' False

    Author Comment

    This makes sense, but not sure if it applies to my situation.
    I want to turn the 0's and 1's from the text file data source:

    12345,"Someone","Name1","Address"," ","City","State",ZIP,0,1,"November",0,0

    to either checked or unchecked boxes on the Word merge doc.  Hope that makes sense.  I'm hoping the 0's and 1's in the data source can control the Check Box on the Merge document.
    LVL 76

    Accepted Solution

    Sorry. I thought that you were wanting to use a separate mechanism from MailMerge to fill in some FormFields.

    Form Fields and Merge Fields are very different and would rarely find themselves on the same document. Indeed, I have just tried, with an unsurprising lack of success, to nest a checkbox form field inside a merge field and get the merge to fill it that way.
    What you can do is to nest the mergefield in an IF field, and to show an character representing a tick or a cross, depending on the result.

    To work with fields, it is better to show the field codes, rather that the field results. Use Alt+F9 to toggle between the two displays. Also, remember that the {} pairs are not inserted using the shifted [ and ] keys, but with Ctrl+F9 or as part of a Field Insert.

    To further complicate things, I have found a couple of WingDing symbols which I can't reproduce here, but which can be inserted into the IF field. They are reported on the insert Symbol dialogue to have character codes 253 and 254 respectively. They are represented below with / (for tick) and X. Use Insert Symbol to put them in your field code.
    Here I have named the merge field : "Maybe". Note that the quotes are generally optional in fields unless   the text item has a space in it.

    This is what the field code looks like:

    { IF { MERGEFIELD "Maybe" } = 1 "/" "X" }


    Author Comment

    Perfect!  That'll work!!  Stretching the envelope.

    Thanks for your help!

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now