Good afternoon, folks. I have been looking at this procedure for three or four days now and I can not see what is wrong with this procedure. I have a form with four checkboxes on it and a subform, I want to have at least one or more of the checkboxes check before I can enter data in the subform. This procedure works great the first time, but if you return to the subform, without checking one of the checkboxes, you can now enter data in the subform, instead of getting booted out of the subform again. Here is the procedure:
Public Sub PartNumber_GotFocus()
With Me
If (.Parent.TypeNumber <> 500) Then
If (.Parent.Check206 + .Parent.Check208 + .Parent.Check210 + .Parent.Check227 = 0) Then
MsgBox "Please Check at Least One Checkbox Before Entering a Part Number or Cancel ECN."
.Parent.Check206.SetFocus
Else
.PartNumber.SetFocus
.Parent.[PartNumber(s)_Label].ForeColor = 33023
End If
Else
.PartNumber.SetFocus
.Parent.[PartNumber(s)_Label].ForeColor = 33023
End If
End With
End Sub
Can anyone see what I am doning wrong? Why does it work the first time and not again? Thank you in advance to anyone who can answer this problem for me.
Public Sub PartNumber_GotFocus()
With Me
If (.Parent.TypeNumber <> 500) Then
If (.Parent.Check206 + .Parent.Check208 + .Parent.Check210 + .Parent.Check227 = 0) Then
MsgBox "Please Check at Least One Checkbox Before Entering a Part Number or Cancel ECN."
.Parent.Check206.SetFocus
Else
.PartNumber.SetFocus
.Parent.[PartNumber(s)_Label].ForeColor = 33023
End If
Else
.PartNumber.SetFocus
.Parent.[PartNumber(s)_Label].ForeColor = 33023
End If
End With
End Sub
Can anyone see what I am doning wrong? Why does it work the first time and not again? Thank you in advance to anyone who can answer this problem for me.