Question : MS Access

I have 3 check boxes that i use for one of my forms. i have a if state so if one is checked the other can not.

what i am looking for is validation so if any of the 3 check boxes are not checked then it will put up a msgbox. this is what i tried so far and it doesnt work correctly since the control source doesnt equal to 0 as stated in my code. if you select and deselect any of the controls then it will put up the msgbox. Any help would be nice.
1:
2:
3:
4:
5:
If CHK1 = "0" And CHK2 = "0" And CHK3 = "0" Then
        MsgBox "Please Select who the Lease was Purchaced From"
        DoCmd.GoToControl "chk1"
        Exit Sub
    End If

Answer : MS Access

Setting the triple state property to NO as cap1 suggested will work.

cyberkiwi's suggestion can also be modified to accomodate NULLs (which you get in a triple state check box that has not been used yet - showing up as grey instead of checked or clear):

If  nz(CHK1,0) + nz(CHK2,0)  + nz(CHK3,0) = 0  Then


The NZ function checks for NULL values, and substitutes some value (in this case 0)  for nulls when they are found.
Random Solutions  
 
programming4us programming4us