referencing forms()

  • Thread starter Thread starter Jason
  • Start date Start date
J

Jason

Hi,

Can someone tell me why i can't set the recordset in a subform?

I use the following to set the recordset of a subform:

Set Forms("mysubform").Recordset = rst

If i just use 1 form it works, but i can't see why it should not work on a
subform. The error says that it cannot find the subform specified in the
code.

I hope someone knows the anwser.
 
You can never reference a subform by its name. You have to get to it via the
Form property of the control that contains it.

(verbose syntax)
Form("ParentName").Controls("SubformControlName").Form.Recordset
or
(concise syntax) ParentName.SubformControlName.Recordset
 
Back
Top