Hello
I have a form with four check boxes. I would like if the user check's off one, than all other check boxes get checked off automatically. How can i do this???
Thank you
Hello
I have a form with four check boxes. I would like if the user check's off one, than all other check boxes get checked off automatically. How can i do this???
Thank you
Copy this code to the forms code module:Replace the Check0 Check2 Check4 Check6 with the names of your check boxes.Code:Public Sub AllOptionSame(bln As Boolean) Me.Check0 = bln Me.Check2 = bln Me.Check4 = bln Me.Check6 = bln End Sub
Put this line of code in the After Update Event of each of the check boxesCode:Call AllOptionSame(Me.ActiveControl.Value)
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
Bob
Thank your for your reply. I'm getting this error in forms code modules
Public Sub AllOptionSame(bln As Boolean)
Me.Cash Cleared = bln
Me.Check Cleared = bln
Me.Credit Card Cleared = bln ( Compile error: Expected: end of statement )
Me.All Cleared = bln
End Sub
Bob
Not sure if i ask the questions the right why. If the user checks off check box All Cleared than all other three check boxes would be checked off.
Thank you
I think the problem is that you have spaces in your field names. Try this:Code:Public Sub AllOptionSame(bln As Boolean) Me.[Cash Cleared] = bln Me.[Check Cleared] = bln Me.[Credit Card Cleared] = bln Me.[All Cleared] = bln End Sub
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
I put the code and it still didn't work. I took off the space and now i'm getting this error Compile error: Method or data member not found.
Can you post a copy of your db
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
Reconciliationzip.zip
This db doesn't have space.
The problem was caused by the spaces. The solution I offered, using the square brackets, failed because one of the control names had a double space.
So,
Me.[Cash Cleared] = bln
needed to be
Me.[Cash Cleared] = bln
Take a look at the attached db and let us know if this is now working as required.
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
Thank you its working. Now the only time that i want it to check off all of them is when All cleared is checked off. If i check off cash than that's the only one that is check off.
Remove this line of code:
Call AllOptionSame(Me.ActiveControl.Value)
from the After Update event of each of the check boxes except the "All Cleared" check box.
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick
Thank you very much it worked great.
Glad to help.
If this helped, please click the star at the bottom left of this posting and add to my reputation. Many thanks.
Bob Fitzpatrick