Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word 2007 Checkboxes & Mailmerge

Status
Not open for further replies.

jebenson

Technical User
Feb 4, 2002
2,956
0
0
US
Hello all,

I have an application that reads from a database and uses that data to do a Merge document in Word 2007. The document is an IRS form, and the merge creates one page (completed form) in the document for each row of data. This is all good and working correctly.

The next step is this: on the IRS forms there are checkboxes that I need to check, depending on whether the form field associated with the checkbox is filled. I can do this, but there is a hitch. Here's the code I use to check the checkbox:

oDoc.FormFields("chkEducation").CheckBox.Value = True

This works, but is checks the Education box on ALL of the forms, even if the Education field is empty. Naturally, if the Education field is empty the checkbox should not be checked. The problem is that the base document is one page, and when the merge is completed it is several pages. The checkbox (chkEducation) in the original document is replicated on all pages of the final merged document, and the checkboxes all have the same name. So the code above checks ALL of them, not just the ones needed.

So my question is, does anybody know how to selectively check a checkbox in a situation like I described?

Thanks,
jebenson



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top