Err:2455 invalid reference to the property Form
Posted on 2011-03-09
I have a form which contains a subform which has a control name of sub_Well_Details. This subform contains some text boxes and also contains a continuous subform (sub_Well_Component_Details). Note that these are the control names, not the name of the forms.
The main form contains a treeview, and if the node selected is at the second level, I make sub_Well_Details visible, but I would also like to disable the Edit and Remove buttons on sub_Well_Component_Details if there are no records in the 2nd level subform. To do this I'm using the following code in the nodeclick event of the treeview control.
Dim frm as Form
set frm = me.sub_Well_Details.form.sub_Well_Component_Details.Form <--- problem is here
frm.cmd_Remove.Enabled = frm.REcordsetclone.recordcount
frm.cmd_Edit.Enabled = frm.cmd_Remove.Enabled
but the line beginning "set frm = " is generating the 2455 error "You entered an expression that has an invalid reference to the property Form/Report."
I have compacted, decompiled, checked my references, but nothing I do has resolved this problem. I know I have used this syntax before for refering to controls on forms and for setting references to forms.
I've also tried:
set frm = forms("frm_Well_Components").sub_Well_Details.form
set frm = form_frm_Well_Components.sub_Well_Details.form