Hey guys,
I'm new to using events in Access for forms and subforms. I am looking to make it that when the user moves on to another record in the form, it validates to make sure all combo boxes and text boxes are not null before you can continue onto the next record. I figured using the On Exit event in the subforms where the records that need validation are would trigger the validation but nothing happens when I move onto another record or if I exit out of the form.
Here is my code:
Any help is appreciated!
I'm new to using events in Access for forms and subforms. I am looking to make it that when the user moves on to another record in the form, it validates to make sure all combo boxes and text boxes are not null before you can continue onto the next record. I figured using the On Exit event in the subforms where the records that need validation are would trigger the validation but nothing happens when I move onto another record or if I exit out of the form.
Here is my code:
Code:
Private Sub sbfrmOtherStats_Exit()
If cboxTeamWorkScore.ListIndex = -1 Then
MsgBox "Please select a score."
cboxTeamWorkScore.SetFocus
Cancel = True
End If
If cboxReliabilityScore.ListIndex = -1 Then
MsgBox "Please select a score."
cboxReliabilityScore.SetFocus
Cancel = True
End If
If cboxAdaptabilityWorkScore.ListIndex = -1 Then
MsgBox "Please select a score."
cboxAdaptabilityScore.SetFocus
Cancel = True
End If
End Sub
Any help is appreciated!