Conditional If function in VBA

  • Thread starter Thread starter sunilkeswani
  • Start date Start date
S

sunilkeswani

how do i make any one of 4 check boxes check1, check2, check3, check4
mandatory, only if the combo "cboName" has entries for a particular
list of names?

i.e I want speicific users to mandatorily select one of the 4 check
boxes, but not all.

Cheers
 
In the form's BeforeUpdate event, put code that checks whether it's one of
the appropriate users. If it is, make sure that they've selected at least
one of the checkboxes.

An easy way to check whether at least one checkbox is selected is:

If Me.check1 Or Me.check2 Or Me.check3 Or Me.check4 Then
' At least one is checked
Else
' None are checked
End If

To check if all are selected, use

If Me.check1 And Me.check2 And Me.check3 And Me.check4 Then
' All four are checked
Else
' At least one isn't checked
End If
 
If you only want them to select ONE of the 4 boxes, perhaps you would be
better off using Option Buttons (radio buttons).
 
You should either stay in the original thread or start a new one, but not
both. Scattering the same question in multiple postings is not good
newsgroup etiquette.
 
But I want this to be atleast one condition only if the value in
another combo box is x, y or z

How can I do this?
 
As I said, put logic to check whether it's one of those!

If Me.MyComboBox = "x" _
Or Me.MyComboBox = "y" _
Or Me.MyComboBox = "z" Then

' Check the checkboxes

End If
 
Back
Top