J
johnlute
Access 2003.
I'm trying to sketch together a code to check a subform for records. A
child record is required in the subform before the parent record can
be saved.
I put this together and it works fine except that after it fires I
can't navigate to the subform. Of course, this is because the parent
record hasn't been saved.
Any ideas how to get around this? I could use and Undo but then a user
might want to kill me every time their data gets undone because
they've forgotten to enter a child record.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim rst As Recordset
Set rst = sfrmINGsAllergens.Form.RecordsetClone
If rst.RecordCount < 1 Then
Beep
MsgBox "Allergen info is required!", vbCritical
Cancel = True
End If
End Sub
Thanks in advance!
I'm trying to sketch together a code to check a subform for records. A
child record is required in the subform before the parent record can
be saved.
I put this together and it works fine except that after it fires I
can't navigate to the subform. Of course, this is because the parent
record hasn't been saved.
Any ideas how to get around this? I could use and Undo but then a user
might want to kill me every time their data gets undone because
they've forgotten to enter a child record.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim rst As Recordset
Set rst = sfrmINGsAllergens.Form.RecordsetClone
If rst.RecordCount < 1 Then
Beep
MsgBox "Allergen info is required!", vbCritical
Cancel = True
End If
End Sub
Thanks in advance!