Sum fields

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

Guest

I have looked for the answer but need to ask sorry!
I have a table containing days and car inspections done for that day. one
field is called 'number of cars'. on a form based on this table, i have
entered a calculation in this text box, which is
=[onefield]-[anotherfield]. So in the table, i want the field 'number of
cars' to show the total of the calculation. I need to save this calculation
into the table as it is important. But the moment I change the record source
from the table to the calculation, it wont save into the table. Please help,
thanks
 
Debba said:
I have looked for the answer but need to ask sorry!
I have a table containing days and car inspections done for that day. one
field is called 'number of cars'. on a form based on this table, i have
entered a calculation in this text box, which is
=[onefield]-[anotherfield]. So in the table, i want the field 'number of
cars' to show the total of the calculation. I need to save this calculation
into the table as it is important. But the moment I change the record source
from the table to the calculation, it wont save into the table. Please help,
thanks

Hi Debba, as the maintenance of the fields used to caluclate the total can
be handled using many different methods it is not recommended to store the
result. Instead recalculate and, only display the result in forms and
reports...

However, if you believe that you can control when the fields are edited a
method to use is the events of controls. That is, for both
[onefield]_afterupdate and [anotherfield]_afterupdate recalculate the total...
txtTotal=[onefield]-[anotherfield]
the total field can then be bound.

Luck
Jonathan Parminter
 
Jonathan said:
Debba said:
I have looked for the answer but need to ask sorry!
I have a table containing days and car inspections done for that day. one
field is called 'number of cars'. on a form based on this table, i have
entered a calculation in this text box, which is
=[onefield]-[anotherfield]. So in the table, i want the field 'number of
cars' to show the total of the calculation. I need to save this calculation
into the table as it is important. But the moment I change the record source
from the table to the calculation, it wont save into the table. Please help,
thanks

Hi Debba, as the maintenance of the fields used to caluclate the total can
be handled using many different methods it is not recommended to store the
result. Instead recalculate and, only display the result in forms and
reports...

However, if you believe that you can control when the fields are edited a
method to use is the events of controls. That is, for both
[onefield]_afterupdate and [anotherfield]_afterupdate recalculate the total...
txtTotal=[onefield]-[anotherfield]
the total field can then be bound.

Luck
Jonathan Parminter
Hey great, thanks very much, have found more questions on this too and
everyone says that it's not common to save the result field! So if I was to
not save the result field and then later on wanted to know how many cars were
checked on a particular day, how would I find this data when it hasn't been
saved?
 
Debba said:
Jonathan said:
Debba said:
I have looked for the answer but need to ask sorry!
I have a table containing days and car inspections done for that day. one
field is called 'number of cars'. on a form based on this table, i have
entered a calculation in this text box, which is
=[onefield]-[anotherfield]. So in the table, i want the field 'number of
cars' to show the total of the calculation. I need to save this calculation
into the table as it is important. But the moment I change the record source
from the table to the calculation, it wont save into the table. Please help,
thanks

Hi Debba, as the maintenance of the fields used to caluclate the total can
be handled using many different methods it is not recommended to store the
result. Instead recalculate and, only display the result in forms and
reports...

However, if you believe that you can control when the fields are edited a
method to use is the events of controls. That is, for both
[onefield]_afterupdate and [anotherfield]_afterupdate recalculate the total...
txtTotal=[onefield]-[anotherfield]
the total field can then be bound.

Luck
Jonathan Parminter
Hey great, thanks very much, have found more questions on this too and
everyone says that it's not common to save the result field! So if I was to
not save the result field and then later on wanted to know how many cars were
checked on a particular day, how would I find this data when it hasn't been
saved?
Hi Debba, use the ability of queries to include calculations. Base forms and
reports on these queries. Have controls bound to calculated fields. This
avoids/reduces reliance on determining events that use vba to rel-calculate
and ensures consistency of calculations, plus reduces maintenance of
calculations.
Luck
Jonathan
 
Jonathan said:
Debba said:
Jonathan said:
:

I have looked for the answer but need to ask sorry!
I have a table containing days and car inspections done for that day. one
field is called 'number of cars'. on a form based on this table, i have
entered a calculation in this text box, which is
=[onefield]-[anotherfield]. So in the table, i want the field 'number of
cars' to show the total of the calculation. I need to save this calculation
into the table as it is important. But the moment I change the record source
from the table to the calculation, it wont save into the table. Please help,
thanks

Hi Debba, as the maintenance of the fields used to caluclate the total can
be handled using many different methods it is not recommended to store the
result. Instead recalculate and, only display the result in forms and
reports...

However, if you believe that you can control when the fields are edited a
method to use is the events of controls. That is, for both
[onefield]_afterupdate and [anotherfield]_afterupdate recalculate the total...
txtTotal=[onefield]-[anotherfield]
the total field can then be bound.

Luck
Jonathan Parminter
Hey great, thanks very much, have found more questions on this too and
everyone says that it's not common to save the result field! So if I was to
not save the result field and then later on wanted to know how many cars were
checked on a particular day, how would I find this data when it hasn't been
saved?
Hi Debba, use the ability of queries to include calculations. Base forms and
reports on these queries. Have controls bound to calculated fields. This
avoids/reduces reliance on determining events that use vba to rel-calculate
and ensures consistency of calculations, plus reduces maintenance of
calculations.
Luck
Jonathan
Thanks again, fast response too! It is obvious isn't it, once you have given
me the answer! Will definitly do it this way it makes alot of sense now.
have a good day
Deb.
 
Back
Top