Atleast one out of 4 check boxes required

S

sunilkeswani

How do i make it mandatory to check atleast one of 4 check boxes?

one the form before update, I have the code for before update


If Me!CheckBox1.Value _
Or Me!CheckBox2.Value _
Then
' This record is okay.
Else
' This record is not okay.
MsgBox "Sorry, you must check at least one box among 1 OR
2"
Cancel = True
End If

How do I do the above for 4 ?

Please help

Cheers
Sunny
 
S

SusanV

I use something similar on a Save button's on click event:

If me.checkbox1 = 0 OR me.checkbox2 = 0 OR me.checkbox3 = 0 OR me.checkbox4
= 0 Then
msgbox "Please Select SOMETHING!"
Exit Sub
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
End if
 
S

sunilkeswani

Ok great I got it

IF Me!Checkbox1 = True OR _
Me!Checkbox2 = True OR _
Me!Checkbox3 = True Then
ELSE
Msgbox "All checkboxes empty, please select one",vbokonly,"Checkbox
problem"
END IF

Thanks !
 
G

Guest

If (Me!CheckBox1 = True OR Me!CheckBox2 = True OR Me!CheckBox3 = True OR
Me!CheckBox 4 = True) Then
' this is OK
Else
MsgBox "You must check at least one check box."
' Put cursor at the first checkbox
Me!CheckBox1.SetFocus
End If

Sprinks
 

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