Total Box

  • Thread starter Thread starter Tim Gordon
  • Start date Start date
T

Tim Gordon

Hi,

I'm just playing with access at the mo so please forgive me if this is a
dumb question:

I've created a form that has a few combo boxes that pull down from a table
an items description and its price (these are two separate fields) - the
other combo boxes do exactly the same but from differing tables. Is there a
way I can put a button on the bottom of the form to calculate the total
price of all the prices? Or a text box that adds them up as they are
displayed? I don't need to save the info at all afterwards.

Any pointers in the right direction would be appreciated.

TIA

Tim
 
Open your form in design view.

If you do not see a Form Footer section at the bottom, click "Form
Header/Footer" on the View menu.

Add a text box to the Form Footer section, and put this into its Control
Source property:
=Sum([Amount])
replacing "Amount" with whatever is the name of your price field.

If you need to see an example, open the Northwind sample database, and then
the form named "Orders Subform".
 
Hi,

Thanks for the quick reply but this is different to what I am trying to do
(I think!)

My form has lots of combo boxes but lets imagine it has two 'Processor' and
'Memory' so that the user can click on the first processor combo box and
select the item 'Pentium 4' that has the cost of $100 as the second field
(which isn't displayed) and then they click on the memory combo box and
select '2GB' and the cost of $400 is displayed until they click the next
combo box. It is this $100 and $400 that I need to add up.

The fields that contain the prices are in differing tables but the field
names are the same.

Should I be using a query somewhere? The form is just based on the tables.

Tim

Allen Browne said:
Open your form in design view.

If you do not see a Form Footer section at the bottom, click "Form
Header/Footer" on the View menu.

Add a text box to the Form Footer section, and put this into its Control
Source property:
=Sum([Amount])
replacing "Amount" with whatever is the name of your price field.

If you need to see an example, open the Northwind sample database, and then
the form named "Orders Subform".

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Tim Gordon said:
I'm just playing with access at the mo so please forgive me if this is a
dumb question:

I've created a form that has a few combo boxes that pull down from a table
an items description and its price (these are two separate fields) - the
other combo boxes do exactly the same but from differing tables. Is
there
a
way I can put a button on the bottom of the form to calculate the total
price of all the prices? Or a text box that adds them up as they are
displayed? I don't need to save the info at all afterwards.
 
Okay, so the amount you are trying to add is not in the form's RecordSource
at all.

Presumably you have all the products in one table, and each combo filters
the products based on ProductType? If so, you can create a query that
contains the source table for our subform with an outer join to the Product
table, and include Product.Amount in the query. Use the query as the source
for your table, and you can sum the amount.

If you do have different tables for processors, memory, and other types, you
are going to run into problems. It would be possible to create a query and
include a DLookup() into the appropriate table for each of your combos, but
it will run like a dog. Better to get the structure right.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Tim Gordon said:
Thanks for the quick reply but this is different to what I am trying to do
(I think!)

My form has lots of combo boxes but lets imagine it has two 'Processor' and
'Memory' so that the user can click on the first processor combo box and
select the item 'Pentium 4' that has the cost of $100 as the second field
(which isn't displayed) and then they click on the memory combo box and
select '2GB' and the cost of $400 is displayed until they click the next
combo box. It is this $100 and $400 that I need to add up.

The fields that contain the prices are in differing tables but the field
names are the same.

Should I be using a query somewhere? The form is just based on the tables.

Tim

Allen Browne said:
Open your form in design view.

If you do not see a Form Footer section at the bottom, click "Form
Header/Footer" on the View menu.

Add a text box to the Form Footer section, and put this into its Control
Source property:
=Sum([Amount])
replacing "Amount" with whatever is the name of your price field.

If you need to see an example, open the Northwind sample database, and then
the form named "Orders Subform".

Tim Gordon said:
I'm just playing with access at the mo so please forgive me if this is a
dumb question:

I've created a form that has a few combo boxes that pull down from a table
an items description and its price (these are two separate fields) - the
other combo boxes do exactly the same but from differing tables. Is
there
a
way I can put a button on the bottom of the form to calculate the total
price of all the prices? Or a text box that adds them up as they are
displayed? I don't need to save the info at all afterwards.
 
Thanks, I do have lots of differing tables - I think I'm going to start
again.

Tim

--
I never wish I was not what I was not when I didn't wish what I was not was
not what I am not.

Allen Browne said:
Okay, so the amount you are trying to add is not in the form's RecordSource
at all.

Presumably you have all the products in one table, and each combo filters
the products based on ProductType? If so, you can create a query that
contains the source table for our subform with an outer join to the Product
table, and include Product.Amount in the query. Use the query as the source
for your table, and you can sum the amount.

If you do have different tables for processors, memory, and other types, you
are going to run into problems. It would be possible to create a query and
include a DLookup() into the appropriate table for each of your combos, but
it will run like a dog. Better to get the structure right.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Tim Gordon said:
Thanks for the quick reply but this is different to what I am trying to do
(I think!)

My form has lots of combo boxes but lets imagine it has two 'Processor' and
'Memory' so that the user can click on the first processor combo box and
select the item 'Pentium 4' that has the cost of $100 as the second field
(which isn't displayed) and then they click on the memory combo box and
select '2GB' and the cost of $400 is displayed until they click the next
combo box. It is this $100 and $400 that I need to add up.

The fields that contain the prices are in differing tables but the field
names are the same.

Should I be using a query somewhere? The form is just based on the tables.

Tim

Allen Browne said:
Open your form in design view.

If you do not see a Form Footer section at the bottom, click "Form
Header/Footer" on the View menu.

Add a text box to the Form Footer section, and put this into its Control
Source property:
=Sum([Amount])
replacing "Amount" with whatever is the name of your price field.

If you need to see an example, open the Northwind sample database, and then
the form named "Orders Subform".


I'm just playing with access at the mo so please forgive me if this
is
 
Back
Top