I want to set recordset for a subform in a mainform. I tried the codes likes below.
Set [Forms]![FrmMain]![FrmSub].Recordset = MyRst
But it doesn't work.
Can you define "doesn't" work? Error#/msg, what happens that shouldn't happen and vice versa...
Of the top of my head, the most usual reason for subform referencing not working, is that the subform control, which is what one references, is named something other than the subform. Easiest way of obtaining the correct name, would be to invoke the expression builder from a control on the main form, then doubleclick through forms, loaded forms, the main form, the subform, and a control on the subform. This will give a reference like
[SubformControlName].Form![txtControlName]
Strip to
Set Me![SubformControlName].Form.Recordset = MyRst
If this doesn't work, then there is probably something else making trouble, perhaps the link child/parent properties of the subform control? Dunno - try it out, and check back with more information.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.