P
Pete
Re Access 2003
I have a form with a subform (#1). The subform has a subform (#2) and I need
to check that if the user moves off the current record on #1, #2 must have
least one record and, if not, cancel the update and move the focus to the
control on #2.
On the subform #1, I have tried using:-
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me!frmAssignedCategories.Form!txtCategoryID) Then
MsgBox "You must assign at least 1 category before leaving this
record.", _
vbCritical, "Attention"
Cancel = True
Me!frmAssignedCategories.Form!txtCategoryID.SetFocus
End If
but this just throws up the warning message every time I try to move focus
to the #2 subform to enter at least on category. If I don't let cancel = True
and the users moves off the current record, that record is then left without
any categories on #2.
Does anyone have a solution to this?
Many thanks.
End Sub
I have a form with a subform (#1). The subform has a subform (#2) and I need
to check that if the user moves off the current record on #1, #2 must have
least one record and, if not, cancel the update and move the focus to the
control on #2.
On the subform #1, I have tried using:-
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me!frmAssignedCategories.Form!txtCategoryID) Then
MsgBox "You must assign at least 1 category before leaving this
record.", _
vbCritical, "Attention"
Cancel = True
Me!frmAssignedCategories.Form!txtCategoryID.SetFocus
End If
but this just throws up the warning message every time I try to move focus
to the #2 subform to enter at least on category. If I don't let cancel = True
and the users moves off the current record, that record is then left without
any categories on #2.
Does anyone have a solution to this?
Many thanks.
End Sub