THis is on a userform for adding a new record on a worksheet.
I have a few 'checks' in place so that certain checkboxes or selections or entries must be added before the form can add the data and create the new record.
All of these checks works fine, except for one of them that checks the controls inside a frame. No matter even if some checkboxes are checked, I still get the warning telling me that no check boxes were checked... What i need it to do is if any checkboxes are checked, then skip the warning and move on to checking the 'check' and so on...
Here is the code... (also, I have tried adding an 'else' in here and no matter where I have it it is it doesn't recognize it at all and even if checkboxes are 'checked', it still thinks none are checked and gives me the warning...
here is the userform, filled out as an example to show what it looks like before running the code (and the subsequent 'check' for checking the controls in the frame...) :
and here it is after running the code (via clicking on the 'new employee information' command button: (and the code telling me that no checkboxes are checked, when they actually are...)
thanks for any help!
I have a few 'checks' in place so that certain checkboxes or selections or entries must be added before the form can add the data and create the new record.
All of these checks works fine, except for one of them that checks the controls inside a frame. No matter even if some checkboxes are checked, I still get the warning telling me that no check boxes were checked... What i need it to do is if any checkboxes are checked, then skip the warning and move on to checking the 'check' and so on...
Here is the code... (also, I have tried adding an 'else' in here and no matter where I have it it is it doesn't recognize it at all and even if checkboxes are 'checked', it still thinks none are checked and gives me the warning...
VBA Code:
' WARNING: "YOU MUST select at least ONE CHECKBOX before the data is accepted!"
Dim Cntrl As Object
For Each Cntrl In fraDepts.Controls
If TypeOf Cntrl Is MSForms.CheckBox Then
If Cntrl.value = False Then
fraDepts.BackColor = vbYellow
MsgBox "You must select at least ONE CHECKBOX" & vbNewLine & "before a new employee can be added:"
fraDepts.BackColor = &HC8DAC6
Exit Sub
End If
End If
Next
here is the userform, filled out as an example to show what it looks like before running the code (and the subsequent 'check' for checking the controls in the frame...) :
and here it is after running the code (via clicking on the 'new employee information' command button: (and the code telling me that no checkboxes are checked, when they actually are...)
thanks for any help!