Conditional mail merge checkboxes

F

franko

I'm creating a mail merge document that will attach to a MS Access database.
One of the merge fields is called "ClassType" and is a numberic value (1-6).
How do I create check boxes on the word document and have the appropriate
checkbox checked depending on the ClassType field value when I do the mail
merge?


I'm new to creating conditional mail merges, so any help would be
appreciated. I've placed six form checkboxes on the document but cant get
them to work with the mail merge.
 
T

tcptang

The codes below work in my document. Hope it helps.

With ActiveDocument.MailMerge.DataSource

' assumed that the merge field "ClassType"
' is the second field in the datasource.
' If it is the 3rd, then change the select statment to
' Select Case .DataFields(3).Value

' init
CheckBox1.Value = False
CheckBox2.Value = False
CheckBox3.Value = False

Select Case .DataFields(2).Value
Case 1
CheckBox1.Value = True
Case 2
CheckBox2.Value = True
Case 3
CheckBox3.Value = True
Case Else
' do nothing
End Select
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top