473,405 Members | 2,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Referring to controls from a subform

kcdoell
230 100+
Hello:

I have read various posts on this subject but still can not get mine to work. Basically I have a Main form (Forecastform) with a subform (Forecast_Subform). In the footer of the subform I have a unbound textbox (TGWP_Sub) that calculates a subtotal of the records that are displayed. In the main form I have another unbound text box (TGWP_Main) that I want to display the value of "TGWP_Sub" In the load event of the Main form I have the following code:

Expand|Select|Wrap|Line Numbers
  1. Me.TGWP_Main = Me!Subform1.Form![TGWP_Sub]
  2.  
I am receiving an error message indicating that it can not find the control TGWP_Sub.

My first question is:

Am I missing something in my vb code.

My second question is:

Since my subtotal can change based on the records will the code in the load event be dynamic so that if changes are made, then my TGWP_Main control will display the latest calculation. If not, what would be the best approach to achieving that?

Any assistance would be appreciated.

Keith.
Mar 20 '08 #1
2 1547
Stewart Ross
2,545 Expert Mod 2GB
Expand|Select|Wrap|Line Numbers
  1. Me.TGWP_Main = Me!Subform1.Form![TGWP_Sub]
  2.  
Hi Keith. There is an error in your references. Your subform name is incorrect, unless it is renamed subform1 in your report.
Expand|Select|Wrap|Line Numbers
  1. Me!TGWP_Main = Me!Forecast_subform.Form![TGWP_Sub]
  2.  
A change to the calculated value on the subform total may need a form requery or refresh to be reflected back to the main form. Try it and see what happens. Form load event just fires once - no more, no less.

-Stewart
Mar 20 '08 #2
kcdoell
230 100+
Hi Keith. There is an error in your references. Your subform name is incorrect, unless it is renamed subform1 in your report.
Expand|Select|Wrap|Line Numbers
  1. Me!TGWP_Main = Me!Forecast_subform.Form![TGWP_Sub]
  2.  
-Stewart

Stewart I tried that and I got a message inside the TGWP_Main indicating that "this control has an invalid control source" (In design mode)

When in view mode TGWP_Main is blank.

Any ideas?

Thanks for the reply.

Keith.
Mar 21 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Joseph J. Egan | last post by:
I am extending an existing Access/VBA app and need to update a subform displayed in continuous view within a containing form. The existing form and subform have worked fine to date with the...
2
by: Salad | last post by:
I have a sub routine that I'd like to use to get data from a main form or from a subform preferably using 1 variable. Ex: If Me.OpenArgs = "SF" Then strForm = "MF!SF" Else strForm = "MF"...
3
by: cefrancke | last post by:
Is there a way to list (through VBA code) all the controls on an open form including subforms, tab controls and all other containers as well. My specific issue is to find all controls with a...
2
by: pietlinden | last post by:
I have a hopefully stupid question. First off, I'm trying to follow Keri Hardwick's instructions from here: http://www.mvps.org/access/forms/frm0031.htm I have a main/sub1/sub-subform:...
0
by: Lauren Quantrell | last post by:
In terms of resources, wondering if it makes a difference in adopting one of the three options below for resizing controls on a form and controls on a subform at the same time. option a.) Put...
3
by: google | last post by:
I'm developing an application for use within my company in Access 2003. I'm new to '03, the application I did for my former employer was in '97. The two applications have similar functionality...
1
by: planetthoughtful | last post by:
Hi All, I have a mainform with a subform in which I show some task summary data. On the mainform I have a number of unbound controls that reflect values relevant to each task in the subform....
6
NeoPa
by: NeoPa | last post by:
Introduction The first thing to understand about Sub-Forms is that, to add a form onto another form takes a special Subform control. This Subform control acts as a container for the form that you...
2
by: csolomon | last post by:
Hello: I would like to use information on one form to populate another form. There are 2 controls I would like to transfer; a list box control and a text box control. both are unbound controls...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.