Sum/Total Subform

B

Bryan Hughes

Hello,

I have a subform that is in a continous for view.

There are 4 fields that the user inputs numbers for each record shown.

On the footer of this subform I have 4 unbound text boxes that I am trying
to put the total entered for each field every time the user adds data to
that field.

Records Field1 Field2 Field3 Field4
Record1 3 0 5 2
Record2 6 3 0 5
Record3 0 5 3 3

Footer Total1 Total2 Total3 Total4
9 8 8 10

I tried making the ControlSource = SUM([FIELD1])
That did not work.

Then I tried to write a function on afterupdate to get the sums entered but
that is not working.

What am I doing wrong, and how can I solve this?

-TFTH
Bryan
 
M

Marshall Barton

Bryan said:
I have a subform that is in a continous for view.

There are 4 fields that the user inputs numbers for each record shown.

On the footer of this subform I have 4 unbound text boxes that I am trying
to put the total entered for each field every time the user adds data to
that field.

Records Field1 Field2 Field3 Field4
Record1 3 0 5 2
Record2 6 3 0 5
Record3 0 5 3 3

Footer Total1 Total2 Total3 Total4
9 8 8 10

I tried making the ControlSource = SUM([FIELD1])
That did not work.


What did it do?

Sum (in the FORM footer) always worked for me so you must be
doing something unusual.
 
D

Dodo

Hello,

I have a subform that is in a continous for view.

There are 4 fields that the user inputs numbers for each record shown.

On the footer of this subform I have 4 unbound text boxes that I am
trying to put the total entered for each field every time the user
adds data to that field.

Records Field1 Field2 Field3 Field4
Record1 3 0 5 2
Record2 6 3 0 5
Record3 0 5 3 3

Footer Total1 Total2 Total3 Total4
9 8 8 10

I tried making the ControlSource = SUM([FIELD1])
That did not work.

Then I tried to write a function on afterupdate to get the sums
entered but that is not working.

What am I doing wrong, and how can I solve this?

-TFTH
Bryan

Are the fields number or text format?
 
B

Bryan Hughes

It does not do anything that is the problem.


Marshall Barton said:
Bryan said:
I have a subform that is in a continous for view.

There are 4 fields that the user inputs numbers for each record shown.

On the footer of this subform I have 4 unbound text boxes that I am trying
to put the total entered for each field every time the user adds data to
that field.

Records Field1 Field2 Field3 Field4
Record1 3 0 5 2
Record2 6 3 0 5
Record3 0 5 3 3

Footer Total1 Total2 Total3 Total4
9 8 8 10

I tried making the ControlSource = SUM([FIELD1])
That did not work.


What did it do?

Sum (in the FORM footer) always worked for me so you must be
doing something unusual.
 
B

Bryan Hughes

Number

Dodo said:
Hello,

I have a subform that is in a continous for view.

There are 4 fields that the user inputs numbers for each record shown.

On the footer of this subform I have 4 unbound text boxes that I am
trying to put the total entered for each field every time the user
adds data to that field.

Records Field1 Field2 Field3 Field4
Record1 3 0 5 2
Record2 6 3 0 5
Record3 0 5 3 3

Footer Total1 Total2 Total3 Total4
9 8 8 10

I tried making the ControlSource = SUM([FIELD1])
That did not work.

Then I tried to write a function on afterupdate to get the sums
entered but that is not working.

What am I doing wrong, and how can I solve this?

-TFTH
Bryan

Are the fields number or text format?
 
B

Bryan Hughes

It is working just not until the complete record is updated not the field.


Marshall Barton said:
Bryan said:
I have a subform that is in a continous for view.

There are 4 fields that the user inputs numbers for each record shown.

On the footer of this subform I have 4 unbound text boxes that I am trying
to put the total entered for each field every time the user adds data to
that field.

Records Field1 Field2 Field3 Field4
Record1 3 0 5 2
Record2 6 3 0 5
Record3 0 5 3 3

Footer Total1 Total2 Total3 Total4
9 8 8 10

I tried making the ControlSource = SUM([FIELD1])
That did not work.


What did it do?

Sum (in the FORM footer) always worked for me so you must be
doing something unusual.
 
M

Marshall Barton

So, the =Sum([Field1]) text box is just blank? Normally,
if there's a problem, you would get #Error.

Are you sure you have the text box in the Form Footer
section and not the page footer?

Are there any other clues that might help us get a grip on
this?
--
Marsh
MVP [MS Access]



Bryan said:
It does not do anything that is the problem.

Bryan said:
I have a subform that is in a continous for view.

There are 4 fields that the user inputs numbers for each record shown.

On the footer of this subform I have 4 unbound text boxes that I am trying
to put the total entered for each field every time the user adds data to
that field.

Records Field1 Field2 Field3 Field4
Record1 3 0 5 2
Record2 6 3 0 5
Record3 0 5 3 3

Footer Total1 Total2 Total3 Total4
9 8 8 10

I tried making the ControlSource = SUM([FIELD1])
That did not work.

"Marshall Barton" wrote
What did it do?

Sum (in the FORM footer) always worked for me so you must be
doing something unusual.
 
M

Marshall Barton

Ahh, now I see what you were asking. Here's the expression
to get the total to update as soon as the control loses the
focus:

=Sum(Field1) - txtField1.OldValue + txtField1

Make sure that the text box's name is different than the
field it is bound to.
--
Marsh
MVP [MS Access]


Bryan said:
It is working just not until the complete record is updated not the field.


"Marshall Barton" wrote
Bryan said:
I have a subform that is in a continous for view.

There are 4 fields that the user inputs numbers for each record shown.

On the footer of this subform I have 4 unbound text boxes that I am trying
to put the total entered for each field every time the user adds data to
that field.

Records Field1 Field2 Field3 Field4
Record1 3 0 5 2
Record2 6 3 0 5
Record3 0 5 3 3

Footer Total1 Total2 Total3 Total4
9 8 8 10

I tried making the ControlSource = SUM([FIELD1])
That did not work.

"Marshall Barton" wrote
What did it do?

Sum (in the FORM footer) always worked for me so you must be
doing something unusual.
 
B

Bryan Hughes

Thank you Marshall,

That is what I needed. It works great.

Bryan

Marshall Barton said:
Ahh, now I see what you were asking. Here's the expression
to get the total to update as soon as the control loses the
focus:

=Sum(Field1) - txtField1.OldValue + txtField1

Make sure that the text box's name is different than the
field it is bound to.
--
Marsh
MVP [MS Access]


Bryan said:
It is working just not until the complete record is updated not the field.


"Marshall Barton" wrote
Bryan Hughes wrote:
I have a subform that is in a continous for view.

There are 4 fields that the user inputs numbers for each record shown.

On the footer of this subform I have 4 unbound text boxes that I am
trying
to put the total entered for each field every time the user adds data to
that field.

Records Field1 Field2 Field3 Field4
Record1 3 0 5 2
Record2 6 3 0 5
Record3 0 5 3 3

Footer Total1 Total2 Total3 Total4
9 8 8 10

I tried making the ControlSource = SUM([FIELD1])
That did not work.

"Marshall Barton" wrote
What did it do?

Sum (in the FORM footer) always worked for me so you must be
doing something unusual.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top