referencing forms()

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.
 
G

George Nicholson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top