kmila
asked on
Error 40036 when passing subform as a variable to procedure
Hi, I'm trying to pass a subform as a variable to a pocedure to be able to access this subform's properties (i.e refresh it later on)
If used the syntax described here but to no effect. I keep getting error 40036 "Method Item of object Forms failed" on the following line of code:
My main form is named: New_frmZamowienia_DaneRzec zywiste
The sub form is named: subform_Notes
The sub form is on a page control tab
Sub and main form are linked through a field.
I'm attaching the whole procedure.
Sub.txt
If used the syntax described here but to no effect. I keep getting error 40036 "Method Item of object Forms failed" on the following line of code:
260 Set fForm = Forms!New_frmZamowienia_DaneRzeczywiste!subform_Notes.Form
My main form is named: New_frmZamowienia_DaneRzec
The sub form is named: subform_Notes
The sub form is on a page control tab
Sub and main form are linked through a field.
I'm attaching the whole procedure.
Sub.txt
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi, substituting
Set fForm = Forms!New_frmZamowienia_Da neRzeczywi ste!subfor m_Notes.Fo rm
with a form object I've passed the Me variable earlier on to worked.
Set fForm = fCallingForm
Thanks for that.
Is there some inherent problem with the way I was trying to assign the form variable. I mean I can still think of a situation where I would need to point directly to a subform from the forms collection.
Set fForm = Forms!New_frmZamowienia_Da
with a form object I've passed the Me variable earlier on to worked.
Set fForm = fCallingForm
Thanks for that.
Is there some inherent problem with the way I was trying to assign the form variable. I mean I can still think of a situation where I would need to point directly to a subform from the forms collection.
<<Is there some inherent problem with the way I was trying to assign the form variable.>>
The only tricky part to this:
Set fForm = Forms!New_frmZamowienia_Da neRzeczywi ste!subfor m_Notes.Fo rm
is that you need to refer to the sub form *control* name on the main form, not the sub forms actual name form name as it appears in the database container. They may not be one in the same.
Jim.
The only tricky part to this:
Set fForm = Forms!New_frmZamowienia_Da
is that you need to refer to the sub form *control* name on the main form, not the sub forms actual name form name as it appears in the database container. They may not be one in the same.
Jim.
Jim