473,398 Members | 2,368 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,398 software developers and data experts.

How do I get a total to refresh in my Form from a Subform

12
Hi,

I've created a main form that populates a subform using 2 combo boxes, however I'm having difficulty trying to create a sum of the total amounts of the results of the population.

I have a Grand_Total field in my form that the subform is based on.

In my main form if I try to reference to the Grand_Total in the form my subform is based on then I get a #Name? error (=forms![form]![Grand_Total) and if I try to calculate it myself it comes up with a #Error (=sum(forms![form]![Amounts])).

Using the reference the only way I can get it to work is to populate the subform, open the form the subform is based on and then click into the subform in my main form. Obviously, that is longwinded and was hoping if there was a way of making it automatic when I click my command button that populates the subform.

Sorry if that's hard to understand, i usually don't explain things very well

Sunny
Feb 17 '11 #1

✓ answered by NeoPa

The sub-form has a .Parent property that points to the SubForm control of the main form. You can reference it that way. If you need further help with how the two forms (Main and Sub) are related to each other then see Referring to Items on a Sub-Form.

4 1613
NeoPa
32,556 Expert Mod 16PB
The sub-form has a .Parent property that points to the SubForm control of the main form. You can reference it that way. If you need further help with how the two forms (Main and Sub) are related to each other then see Referring to Items on a Sub-Form.
Feb 17 '11 #2
Jinzuku
12
Sorry for being dumb but I don't really understand how it gets my to display the total of the data in the subform. Would any other information be useful? I'm reletively new to Access and have vitrually no knowledge of VBA.

I tried looking that your other article but it just went over my head.
Feb 17 '11 #3
Jinzuku
12
Sorry again but I think I've sorted it out based on what I could understand from your suggestion. I replaced the coding in my text box to "=Forms![Main Form]![Subform]![Grand_Total]" and that has seemed to work.

Thanks for your help
Feb 17 '11 #4
NeoPa
32,556 Expert Mod 16PB
Once you have a reference to the relevant form, you can use .Refresh or .Requery to update the data on the form from the underlying tables. .Requery is required in place of .Refresh only when underlying records have been added or removed.
Feb 17 '11 #5

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

Similar topics

0
by: Josh C. | last post by:
Hello everyone. I'm a bit of an Access newbie, so please bear with me. Please go to http://www.dumoti.com/access/ to view the database - 536kb. I'll go straight into examples: In the form...
3
by: Simone | last post by:
Hi All, I have a Find Record button setup in most of my forms in order to find a specific customer's details. I have just noticed today though that this search will only find the customer if it...
5
by: ego | last post by:
Hi all , I had created the following Form/SubForm structure : MainForm SubForm A (SubForm of MainForm) SubForm B (SubForm of SubForm A) SubForm C (SubForm of SubForm B) SubForm D ...
9
by: PC Datasheet | last post by:
I'm stuck on something that seems should be easy and I need some help. My main form has an option group with five options. My subform chooses from different lists depending on which option is...
10
by: Thelma Lubkin | last post by:
My form/subform combination that allows user to display 'ColorSet' records, move to other records via a selector, to add,delete, and edit them, and to manage the related 'Color' records from the...
3
by: ghat12 | last post by:
Hi, I have created a form containing 5 textfields/combo boxes and a command button to conduct searches for matching records. My results are currently displayed as a separate datasheet which is...
5
by: Ron | last post by:
Hi All, I've got a form called frmCust that has a subform on it called sfrmBalance. sfrmBalance's control source is a query called qryTrans4CustBal. sfrmBalance has one field on it called...
2
by: hawg1 | last post by:
I'm fairly new to Access and need help with form/subform. I've seen another access database in which a main form allowed the user to enter school class specific information shuch as start date,...
3
by: virtualgreek | last post by:
Dear all, I have a scenario that is driving me nuts. (MS Access 2003) I have a form/subform (Continuous form) where it gets its data from tables Order and Order_Details. In the footer...
1
by: troy_lee | last post by:
I have a table (Table A). It has one field, a PK. It is in a 1:M with another table (Table B). I am having trouble with a form/subform setup to view the 1:M records. On the parent form, there is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.