How do I sum up values only when checked?

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

Guest

I have a database where we are selling items for customers. Therefore, when
an item is sold (ie. the check box is "checked"), I want to add the price of
the item to the total amount owed to the customer.

Anyone know a good approach to this?
 
I have a database where we are selling items for customers. Therefore, when
an item is sold (ie. the check box is "checked"), I want to add the price of
the item to the total amount owed to the customer.

Anyone know a good approach to this?

One way would be to create a Totals query with a criterion of True on
the "checked" field.

John W. Vinson[MVP]
 
Are you suggesting i create another subform? I understand that the criteria
should be yes for the check field, but how do i add up the totals etc...
 
Are you suggesting i create another subform? I understand that the criteria
should be yes for the check field, but how do i add up the totals etc...

No. I didn't say anything about Forms; I suggested a Totals Query
against the database. Data is not stored in forms, but in tables.

If you're already displaying the data on a Form you can include a
calculated field in the Query upon which the form is based:

AddThis: IIF([checkbox] = True, [FieldToAdd], 0)

You can then put a textbox on the Form (or Subform) Footer with a
control source

=Sum([AddThis])

to add up only the checked rows.

John W. Vinson[MVP]
 

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

Similar Threads


Back
Top