Working out totals on a form (1 Viewer)

chris_elevate

Registered User.
Local time
Today, 08:37
Joined
Apr 18, 2008
Messages
27
Hi,

My questions has 2 parts but they are both based on working our totals within an access db.

1. How can I add up values of a subform on the parent form?
I've got a customer who has made 5 hires which appear in a subform when the customer is selected on the main form. I want to the total income raised from these hires and also show the balance needed to be paid but the customer.

2. On a report I need to add up all the hires. I've made a report which lists all the customers and their hires. How can I add up all the costs of these hires and put it at the bottom of the page. I'd like have the page total and at the end of the roport the overall total.

Thanks
 

ErikSnoek

Programmer
Local time
Today, 00:37
Joined
Apr 26, 2007
Messages
100
Included a sample database. Check out frmMain and rptMain.

Hope this helps :)
 

Attachments

  • sum.zip
    23.9 KB · Views: 102

chris_elevate

Registered User.
Local time
Today, 08:37
Joined
Apr 18, 2008
Messages
27
Thanks.

Ok my sub form is correctly calculating the value. I've made it visable so I can test it. I'm not managing to put the result on the main form though.

My sub form is called: Tbl_CustomerHireListsubform
And the main form is called: Frm_Hire

And I've used a text box called txtTotal with the code:
=Tbl_CustomerHireListsubform.Form!txtHiddenSum inside it.

Is this not correct?
 
M

Mike375

Guest
=[SPP]![Text66]

In a texbox on my main form and with subform called SPP and Text66 being on the subform
 

chris_elevate

Registered User.
Local time
Today, 08:37
Joined
Apr 18, 2008
Messages
27
Thanks Mike

I've used this on the main form:
=[Tbl_CustomerHireListsubform]![txtHiddenSum]

And it still isnt working??!!!! - Puzzled!!??
 

boblarson

Smeghead
Local time
Today, 00:37
Joined
Jan 12, 2001
Messages
32,059
You need to use the subform CONTROL name, not necessarily the subform name. And, you need to tell access that you want the item on the form (.Form.)

So, like this (if your subform Control on the main form is called Tbl_CustomerHireListsubform)

=[Tbl_CustomerHireListsubform].Form![txtHiddenSum]
 

chris_elevate

Registered User.
Local time
Today, 08:37
Joined
Apr 18, 2008
Messages
27
Ok.... I think I get you. So you don't refer to it as the form name but rather the CONTROL name?

So how do I fond out the control name of the subform?

Thanks
 

chris_elevate

Registered User.
Local time
Today, 08:37
Joined
Apr 18, 2008
Messages
27
Sorry Bob it still makes no sense. Just taken a look at that and I still don't know what to change this to:

=[Tbl_CustomerHireListsubform].Form![txtHiddenSum]
 

boblarson

Smeghead
Local time
Today, 00:37
Joined
Jan 12, 2001
Messages
32,059
That is the Control Source of the text box on the main form that you want to display the total in.
 
M

Mike375

Guest
This also worked on mine

=[SPP].[Form]![Text66]

It automatically put the brackets around form
 

chris_elevate

Registered User.
Local time
Today, 08:37
Joined
Apr 18, 2008
Messages
27
It doesn't work on mine though....

I've used:

=[Tbl_CustomerHireListsubform].[Form]![txtHiddenSum]

Is this not correct?
 

Users who are viewing this thread

Top Bottom