Solved

Err:2455  invalid reference to the property Form

Posted on 2011-03-09
6
534 Views
Last Modified: 2012-05-11
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

and

set frm = form_frm_Well_Components.sub_Well_Details.form
0
Comment
Question by:Dale Fye (Access MVP)
  • 4
  • 2
6 Comments
 
LVL 75
ID: 35090877
Is there any change that sub form object does not yet exist at the time the code is executed ?

mx
0
 
LVL 75
ID: 35091255
How about this Dale:
 
With me.sub_Well_Details.form.sub_Well_Component_Details.Form   <--- problem is here
     .cmd_Remove.Enabled = .Recordsetclone.recordcount
     .cmd_Edit.Enabled = .cmd_Remove.Enabled
End With

mx
0
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 0 total points
ID: 35123065
Joe,

Have tried the above, but have not had the opportunity to import all objects into a new accdb yet (am babysitting the grand-children this week while their parents are on vacation).  Hope to get a chance to look at this later this week.
0
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 75
ID: 35123094
ok
0
 
LVL 47

Author Closing Comment

by:Dale Fye (Access MVP)
ID: 35304296
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.
0
 
LVL 75
ID: 35305864
ok. good.

mx
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question