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!

Locking out other check boxes 1

Status
Not open for further replies.

childlead

Technical User
Jul 13, 2001
21
0
0
US
hi.

i want to code vba on to my check box such that when box 1 is checked, then the user would be unable to check box 2 or vice versa. does anyone know how i can code this? thank you for your help.
 
From the OnClicked even of the box being clicked, you can do the following:

if me.YourCheckboxName.Value = true then
me.YourOtherCheckboxName.Enabled = false
else
me.YourOtherCheckboxName.Enabled = true
end if.

Do the same for your other check box only reversing the control names...

There are more elegant ways of doing this, but this is just a quick suggestion petersdaniel@hotmail.com
"If A equals success, then the formula is: A=X+Y+Z. X is work. Y is play. Z is keep your mouth shut." --Albert Einstein

 
Hi!

Another option would be to use an option group. If you put your check boxes in an option group then Access will make sure only one at a time will be selected. A couple of things you will need to know:

Access will not keep other options from being selected, it will only make sure that one is selected at any time.

The option group's value will be the option value of the selected check box. This is how you determine in code which check box is selected.

hth
Jeff Bridgham
bridgham@purdue.edu
 
That too... petersdaniel@hotmail.com
"If A equals success, then the formula is: A=X+Y+Z. X is work. Y is play. Z is keep your mouth shut." --Albert Einstein

 
Actual, the CUA standards for check-boxes in an option group type of control call for none, one or more being "check-able". If you really want just ONE option in a group to be usable, you should use RADIO BUTTONS instead. Just a thought...

Jim There are two ways to argue with a woman - neither one works.
Another free Access forum:
More Access stuff at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top