Solved

Err:2455  invalid reference to the property Form

Posted on 2011-03-09
6
533 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

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
Is there any change that sub form object does not yet exist at the time the code is executed ?

mx
0
 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
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
Comment Utility
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 75

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
ok
0
 
LVL 47

Author Closing Comment

by:Dale Fye (Access MVP)
Comment Utility
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

Expert Comment

by:DatabaseMX (Joe Anderson - Access MVP)
Comment Utility
ok. good.

mx
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

763 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now