By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,480 Members | 3,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,480 IT Pros & Developers. It's quick & easy.

Disabling selected checkboxes when one other checkbox is selected

P: 2
Please help. I have, say, 10 checkboxes on a form. I would like the form to disable, say checkbox 7 and 8 if I select checkbox 1. How do I achieve this.
Jan 17 '07 #1
Share this Question
Share on Google+
6 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Please help. I have, say, 10 checkboxes on a form. I would like the form to disable, say checkbox 7 and 8 if I select checkbox 1. How do I achieve this.
In the After Update event of checkbox 1 you can put the following code. I am using 'check1' as the checkbox name you will need to change it.

Expand|Select|Wrap|Line Numbers
  1. Private Sub check1_AfterUpdate()
  2.  
  3.    If check1 Then ' if checkbox 1 is ticked
  4.       Me.check7.Enabled = False
  5.       Me.check8.Enabled = False
  6.    Else
  7.       Me.check7.Enabled = True
  8.       Me.check8.Enabled = True
  9.    End If
  10.  
  11. End Sub
  12.  
Mary
Jan 17 '07 #2

P: 2
Thanks lots Mary. It works great.
Jan 17 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
Thanks lots Mary. It works great.
That's good Tafi

I'm glad to hear it.

Mary
Jan 17 '07 #4

NeoPa
Expert Mod 15k+
P: 31,186
Another way of doing it :
Expand|Select|Wrap|Line Numbers
  1. Private Sub Check1_AfterUpdate()
  2.     Me!Check7.Enabled = Not Me!Check1
  3.     Me!Check8.Enabled = Not Me!Check1
  4. End Sub
Jan 18 '07 #5

MMcCarthy
Expert Mod 10K+
P: 14,534
Another way of doing it :
Expand|Select|Wrap|Line Numbers
  1. Private Sub Check1_AfterUpdate()
  2.     Me!Check7.Enabled = Not Me!Check1
  3.     Me!Check8.Enabled = Not Me!Check1
  4. End Sub
Did you do this while you were talking to me Ade or since.

Anyway, I remembered this after I posted but am so used to doing it the other way I didn't think of this at the time.

Mary
Jan 19 '07 #6

NeoPa
Expert Mod 15k+
P: 31,186
I think this was before in fact.
Jan 19 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.