Solved

Err:2455  invalid reference to the property Form

Posted on 2011-03-09
6
537 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)
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 48

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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75
ID: 35123094
ok
0
 
LVL 48

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

690 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