Total on a subform

ManuNeko

Registered User.
Local time
Today, 20:21
Joined
Aug 23, 2006
Messages
31
I have a form with general information and then a subform where I enter items, price and quantity. I want to see the total form the lines that I have enter and keep the total up to date as I enter new lines.

Can anyone explain how to do this? I have tried a few things, but none give the result I would like.:confused:

Thanks
 
in the subform have a footer, and put the totals in the footer

the text box sources are

=count(fieldname) for a count or
=sum(fieldname) for a sum,

if its ok, access will add square brackets

although to use this exact syntax the field has to be declared in the query - you can't use calculated fields on the form in quite this way
 
Look at "DemoContinuousTotalA2000.mdb",
I think it can help you.
 

Attachments

That is one of my problems: I treid putting the total fiield on the footer of the subform, but I can not see the footer!

I have no idea why the footer is not visible or how to make it visible.
 
Hello Manu!

Open form in design view, click on VIEW, select "Form Header/Footer".
 
In design view I can see the footer, I have a textbox on that footer. The problem is that I can't see the footer at run time. That is why I can't see my toal field, because I don't have a footer at run time.
 
i copied a form from somewhere that did that to me. i couldn't get the headfer footer pair to display. in the end i had to create a new blank form and copied everything into the new form, and then it worked ok

a bit if a pain, but try that.
 
Is it possible that the header/footer does not display because I am using a datasheet view?

If so, how do I solve my problem: viewing the total?
 
Check VISIBLE properties for Form Footer.
 
Yes it is the problem, put Continuous in Default View.
 
You cannot see subform footers or headers when in datasheet view. To get round this you can put an unbound text box on your main form and populate it with the data in the calculated fields from the footer of your subform. Or of course as MStef said use the subform in Continuous View.
 
Fear Naught I tried it and it looks very good.

Thanks guys, all of you.
 
Fear Naught said:
You cannot see subform footers or headers when in datasheet view. To get round this you can put an unbound text box on your main form and populate it with the data in the calculated fields from the footer of your subform. Or of course as MStef said use the subform in Continuous View.

In what field do you put that? I tried in default Value, but it doesn't update.

Thanks!
 
You won't see the header/footer in datasheet view -- that is correct. Place an unbound textbox in the main form -- that too is correct. To reference the subform, simply treat the entire thing like a control (which it is). For example:

Subform Name: s_Form
Subform Totals textbox name: s_Totals
Main form Name: m_Form

To access the value of s_Totals on m_Form, do this to an unbound textbox's control source on the main form:

m_Form.s_Form.s_Totals.Value

~Moniker
 
Ah.

That's what confused me. He said unbound, so I assumed you had to leave it unbound.

Thanks!
 
in the subform have a footer, and put the totals in the footer

the text box sources are

=count(fieldname) for a count or
=sum(fieldname) for a sum,

if its ok, access will add square brackets

although to use this exact syntax the field has to be declared in the query - you can't use calculated fields on the form in quite this way

That is what I was looking for, thank you very much!

Keywords: Sum, Adding, Count, Counting, subform
 

Users who are viewing this thread

Back
Top Bottom