referencing forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have form A and form B is a subform to A. What I want to do is validation of items on form B from the save on form A
Say I just want to ensure that there at least one record; IsNull(.....? I have tried Forms!.B.control but it keeps telling me that it can not fine form B, even though the reference is character for character. Any help would be appreciated.
 
A subform is not open in its own right...it is a child of the main form, and
therefore you need to reference it through the main form. To do what you
seek, you could run code similar to this in the button's code:

If Me.SubformControlName.Form.RecordsetClone.RecordCount =0 Then
MsgBox "There are no records in the subform!"
Exit Sub
End If

Note that SubformControlName is the name of the control that holds the
subform (which may or may not be the name of the source object of that
subform control).

--
Ken Snell
<MS ACCESS MVP>

Derek said:
I have form A and form B is a subform to A. What I want to do is
validation of items on form B from the save on form A.
Say I just want to ensure that there at least one record; IsNull(.....? I
have tried Forms!.B.control but it keeps telling me that it can not fine
form B, even though the reference is character for character. Any help
would be appreciated.
 
Back
Top