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
Solved

Control Reference in a Subform from another Subform

Posted on 2011-02-26
7
276 Views
Last Modified: 2012-05-11
I have a Main Form with 2 Subforms (not nested) and from code in 1st subform I'm trying to reference a control in the 2nd subform in this manner:

Me.Parent!fsubForm2.Form!ctlText.Visible = False

I get a Runtime Error '2465' with a message stating can't find field.

Can Anyone Help Me ?

0
Comment
Question by:HSdba
  • 4
  • 2
7 Comments
 
LVL 75
ID: 34989979
The syntax is correct ...  but you can try this minor variation:


Me.Parent.fsubForm2.Form.ctlText.Visible = False

Are you *sure* that   ctlText  and fsubForm2 are the correct Names of these objects ?

mx
0
 
LVL 75
ID: 34989992
Can you upload the db  and explain exactly how to reproduce the problem ?

mx
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 34990653
It may be because fsubForm2 is the name of your subform where it should be the name of the control on the parent form holding that subform.

/gustav
0
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.

 
LVL 75
ID: 34991858
Actually, as long as they are the same  (which is the default), then it is still ok.  Only if they are different - does that matter ... which may be the case.

mx
0
 

Accepted Solution

by:
HSdba earned 0 total points
ID: 35000918
I guess I should have specified the form event where this error occured: The Error occurs in the Form_Current event of the continous subform when the 1st subform opens. I see now it's because the 2nd subform isn't open until the Main Form Is fully loaded.
I used the Form_Open event in 2nd sub-form to initialize my controls and trapped error in the  Form_Current event of 1st subform.
There is no Error in Form_Current event of 1st subform when changing  records in continous subform and I'm able to reference controls and do what ever I wanted.
0
 
LVL 75
ID: 35871352
Has this question been resolved?  Can we close the question ?

thx.mx
0
 

Author Closing Comment

by:HSdba
ID: 36472135
I resolved this on my own as stated.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

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…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
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 …

839 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