Subtotal on a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form which allows people to select (Yes/No checkbox) the
transactions that they want to post. What I want to do is I want to have a
text box on the bottom of the form that gives me total (on the transactions
that are selected) after they select each transaction.

I tried to use "DSum" and got an error message "#error".

Thanks.
 
if the form set to Single Form, to add up few fields in the form, write in
the control source of the text box

=nz(field1,0)+nz(field2,0)+nz(field3,0)+nz(field4,0)
 
Thanks for your response. My form is a continuous form. The users will
allow to select the transactions individually by checking each box, or they
can click on a button to select all the transactions on the form.

What I want to do is to get a total in the text box of the transactions that
are selected whether the users select individually or select all when they
click on the command button.

Thanks.
 
To sum the values of a field in the form you should use
=Sum(nz([FieldName],0))

If you want to add the sum of few fields
=Sum(nz([FieldName],0)+nz([FieldName2],0))
 
Thanks for your help. I used the formula "=Sum(nz([FieldName],0))", and it's
not working.

It gives me a total of all the records on the form whether I have those
records selected to post or not. I only want the total of those records that
are selected to post. The text box of total should simultaneous add or
subtract after I select or deselect those records on the form.

Thanks.

Ofer said:
To sum the values of a field in the form you should use
=Sum(nz([FieldName],0))

If you want to add the sum of few fields
=Sum(nz([FieldName],0)+nz([FieldName2],0))

--
I hope that helped
Good luck


AccessHelp said:
Thanks for your response. My form is a continuous form. The users will
allow to select the transactions individually by checking each box, or they
can click on a button to select all the transactions on the form.

What I want to do is to get a total in the text box of the transactions that
are selected whether the users select individually or select all when they
click on the command button.

Thanks.
 
Try this

=Sum(IIF([CheckBoxName] = True,nz([FieldName],0),0))

--
I hope that helped
Good luck


AccessHelp said:
Thanks for your help. I used the formula "=Sum(nz([FieldName],0))", and it's
not working.

It gives me a total of all the records on the form whether I have those
records selected to post or not. I only want the total of those records that
are selected to post. The text box of total should simultaneous add or
subtract after I select or deselect those records on the form.

Thanks.

Ofer said:
To sum the values of a field in the form you should use
=Sum(nz([FieldName],0))

If you want to add the sum of few fields
=Sum(nz([FieldName],0)+nz([FieldName2],0))

--
I hope that helped
Good luck


AccessHelp said:
Thanks for your response. My form is a continuous form. The users will
allow to select the transactions individually by checking each box, or they
can click on a button to select all the transactions on the form.

What I want to do is to get a total in the text box of the transactions that
are selected whether the users select individually or select all when they
click on the command button.

Thanks.

:

if the form set to Single Form, to add up few fields in the form, write in
the control source of the text box

=nz(field1,0)+nz(field2,0)+nz(field3,0)+nz(field4,0)

--
I hope that helped
Good luck


:

I have a form which allows people to select (Yes/No checkbox) the
transactions that they want to post. What I want to do is I want to have a
text box on the bottom of the form that gives me total (on the transactions
that are selected) after they select each transaction.

I tried to use "DSum" and got an error message "#error".

Thanks.
 
Thanks again. It works with this formula when I click on the select
(deselect) all records command button. However, it does not work when I
select or deselect each record individually.

I think the problem is the records are not refreshed to the bound table. I
have the checkbox bound to the table. How can I refresh the form so that it
would reflect to the bound table simultaneously when I check the box?

Thanks.

Ofer said:
Try this

=Sum(IIF([CheckBoxName] = True,nz([FieldName],0),0))

--
I hope that helped
Good luck


AccessHelp said:
Thanks for your help. I used the formula "=Sum(nz([FieldName],0))", and it's
not working.

It gives me a total of all the records on the form whether I have those
records selected to post or not. I only want the total of those records that
are selected to post. The text box of total should simultaneous add or
subtract after I select or deselect those records on the form.

Thanks.

Ofer said:
To sum the values of a field in the form you should use
=Sum(nz([FieldName],0))

If you want to add the sum of few fields
=Sum(nz([FieldName],0)+nz([FieldName2],0))

--
I hope that helped
Good luck


:

Thanks for your response. My form is a continuous form. The users will
allow to select the transactions individually by checking each box, or they
can click on a button to select all the transactions on the form.

What I want to do is to get a total in the text box of the transactions that
are selected whether the users select individually or select all when they
click on the command button.

Thanks.

:

if the form set to Single Form, to add up few fields in the form, write in
the control source of the text box

=nz(field1,0)+nz(field2,0)+nz(field3,0)+nz(field4,0)

--
I hope that helped
Good luck


:

I have a form which allows people to select (Yes/No checkbox) the
transactions that they want to post. What I want to do is I want to have a
text box on the bottom of the form that gives me total (on the transactions
that are selected) after they select each transaction.

I tried to use "DSum" and got an error message "#error".

Thanks.
 
The problem is, when you click on the check box, the record is not saved yet,
so it wont reflect until you move to the next record.

So mybe try and save the record on the after update event of the check box
using

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

--
I hope that helped
Good luck


AccessHelp said:
Thanks again. It works with this formula when I click on the select
(deselect) all records command button. However, it does not work when I
select or deselect each record individually.

I think the problem is the records are not refreshed to the bound table. I
have the checkbox bound to the table. How can I refresh the form so that it
would reflect to the bound table simultaneously when I check the box?

Thanks.

Ofer said:
Try this

=Sum(IIF([CheckBoxName] = True,nz([FieldName],0),0))

--
I hope that helped
Good luck


AccessHelp said:
Thanks for your help. I used the formula "=Sum(nz([FieldName],0))", and it's
not working.

It gives me a total of all the records on the form whether I have those
records selected to post or not. I only want the total of those records that
are selected to post. The text box of total should simultaneous add or
subtract after I select or deselect those records on the form.

Thanks.

:

To sum the values of a field in the form you should use
=Sum(nz([FieldName],0))

If you want to add the sum of few fields
=Sum(nz([FieldName],0)+nz([FieldName2],0))

--
I hope that helped
Good luck


:

Thanks for your response. My form is a continuous form. The users will
allow to select the transactions individually by checking each box, or they
can click on a button to select all the transactions on the form.

What I want to do is to get a total in the text box of the transactions that
are selected whether the users select individually or select all when they
click on the command button.

Thanks.

:

if the form set to Single Form, to add up few fields in the form, write in
the control source of the text box

=nz(field1,0)+nz(field2,0)+nz(field3,0)+nz(field4,0)

--
I hope that helped
Good luck


:

I have a form which allows people to select (Yes/No checkbox) the
transactions that they want to post. What I want to do is I want to have a
text box on the bottom of the form that gives me total (on the transactions
that are selected) after they select each transaction.

I tried to use "DSum" and got an error message "#error".

Thanks.
 
Thank you very, very, very much for your helps. The problems are solved. As
far as the refresh problem, I inserted this formula "Me.Refresh" in the On
Click event for the check box object.

Thanks again.

Ofer said:
The problem is, when you click on the check box, the record is not saved yet,
so it wont reflect until you move to the next record.

So mybe try and save the record on the after update event of the check box
using

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

--
I hope that helped
Good luck


AccessHelp said:
Thanks again. It works with this formula when I click on the select
(deselect) all records command button. However, it does not work when I
select or deselect each record individually.

I think the problem is the records are not refreshed to the bound table. I
have the checkbox bound to the table. How can I refresh the form so that it
would reflect to the bound table simultaneously when I check the box?

Thanks.

Ofer said:
Try this

=Sum(IIF([CheckBoxName] = True,nz([FieldName],0),0))

--
I hope that helped
Good luck


:

Thanks for your help. I used the formula "=Sum(nz([FieldName],0))", and it's
not working.

It gives me a total of all the records on the form whether I have those
records selected to post or not. I only want the total of those records that
are selected to post. The text box of total should simultaneous add or
subtract after I select or deselect those records on the form.

Thanks.

:

To sum the values of a field in the form you should use
=Sum(nz([FieldName],0))

If you want to add the sum of few fields
=Sum(nz([FieldName],0)+nz([FieldName2],0))

--
I hope that helped
Good luck


:

Thanks for your response. My form is a continuous form. The users will
allow to select the transactions individually by checking each box, or they
can click on a button to select all the transactions on the form.

What I want to do is to get a total in the text box of the transactions that
are selected whether the users select individually or select all when they
click on the command button.

Thanks.

:

if the form set to Single Form, to add up few fields in the form, write in
the control source of the text box

=nz(field1,0)+nz(field2,0)+nz(field3,0)+nz(field4,0)

--
I hope that helped
Good luck


:

I have a form which allows people to select (Yes/No checkbox) the
transactions that they want to post. What I want to do is I want to have a
text box on the bottom of the form that gives me total (on the transactions
that are selected) after they select each transaction.

I tried to use "DSum" and got an error message "#error".

Thanks.
 
Back
Top