I have a form with 3 text boxes fields, 1 combo box field and 8 check boxes fields. The text boxes, the combo box and 6 check boxes have a tag name "Req". After the last checkbox, the user press a button to save the record and close the form. At this point, I want to validate if all fields with the "Req" tag are filled or checked - if not, will prompt a message that there's a field that's missing.
I have this code running, but it only works for the text boxes and the combo box. What I'm missing?
Private Sub abtnCommand1_Click()
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "Req" And IsNull(ctl) Then
MsgBox "Required fields missing. Fill or check missing fields", vbCritical, "Missing fields"
ctl.BackColor = vbYellow