Click One Checkbox and have others follow

C

Chris

I have a list of 20 different items that have checkboxes that need to be
clicked for them to be included on a list. I want to be able to click a
master checkbox and have all 20 different items have their checkboxes clicked
and be included on the list. Any ideas?

Thanks,

Chris
 
F

fredg

I have a list of 20 different items that have checkboxes that need to be
clicked for them to be included on a list. I want to be able to click a
master checkbox and have all 20 different items have their checkboxes clicked
and be included on the list. Any ideas?

Thanks,

Chris

If there are additional check boxes on the form (besides the 20), code
that master check box's AfterUpdate event:
Me.Check1 = Me.MasterCheck
Me.Check2 = Me.MasterCheck
etc......
Me.Check20 = Me.MasterCheck

If those 20 different check boxes on the form are the ONLY check boxes
on the form, you could use:

Dim c as control
For each c in controls
if typeof c is CheckBox then
c = Me.MasterCheck
End If
Next c
 
C

Chris

Fred,

Do I put an If/Then statement before the Me.Check1 and the what do I do if
the number of checkboxes changes depending on which category I'm in?
 
F

fredg

Fred,

Do I put an If/Then statement before the Me.Check1 and the what do I do if
the number of checkboxes changes depending on which category I'm in?

Which sample of code are you referring to?
There is no If..Then in the example that uses Me.Check1.
Just list each check box to be changed when the master check box is
changed.
Write the code exactly as I wrote it, just using your check box names.

What do you mean by your second remark about the number of check boxes
changing.
If you use the first example, you simply refer to the check boxes you
wish to include when the master chdeck box is changed.

If you have something more going on here than your original post
indicated (one check box to change 20 others), you are doing yourself
a disservice by not being up front about it.
 

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