Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Control Reference in a Subform from another Subform

Posted on 2011-02-26
7
Medium Priority
?
302 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
[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
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 52

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
Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

618 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