Dale Fye
asked on
Err:2455 invalid reference to the property Form
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_Detail s). 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.s ub_Well_Co mponent_De tails.Form <--- problem is here
frm.cmd_Remove.Enabled = frm.REcordsetclone.recordc ount
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_Wel l_Details. form
and
set frm = form_frm_Well_Components.s ub_Well_De tails.form
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
Dim frm as Form
set frm = me.sub_Well_Details.form.s
frm.cmd_Remove.Enabled = frm.REcordsetclone.recordc
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
and
set frm = form_frm_Well_Components.s
How about this Dale:
With me.sub_Well_Details.form.s ub_Well_Co mponent_De tails.Form <--- problem is here
.cmd_Remove.Enabled = .Recordsetclone.recordcoun t
.cmd_Edit.Enabled = .cmd_Remove.Enabled
End With
mx
With me.sub_Well_Details.form.s
.cmd_Remove.Enabled = .Recordsetclone.recordcoun
.cmd_Edit.Enabled = .cmd_Remove.Enabled
End With
mx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ok
ASKER
Joe, I was unable to resolve this problem until I imported everything into a new accdb, so my project must have experienced some form of corruption.
ok. good.
mx
mx
mx