Keeping a Total from an ever-changing numeric field

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

Guest

Basically, I've got one numeric field on the Access form (Meters). The data
changes in this field daily. What I want to do is have another numeric field
(Total Meters) which keeps a sum of all the data that has been entered into
the (Meters field. This doesn't work with the =sum(Meters) command, as the
figures just replace each other, they don't add (as they are being
overwritten daily!)

I am aware the other option is to have more (Meters) fields, then sum them
all up into the (Total Meterage) field, but I'm trying to keep the Database
as compact as possible...

It sound like an easy one.... but it ain't .... any help- much appreciated.
Thanx
 
On Wed, 9 Nov 2005 08:16:03 -0800, "Simple but Confused" <Simple but
Basically, I've got one numeric field on the Access form (Meters). The data
changes in this field daily. What I want to do is have another numeric field
(Total Meters) which keeps a sum of all the data that has been entered into
the (Meters field. This doesn't work with the =sum(Meters) command, as the
figures just replace each other, they don't add (as they are being
overwritten daily!)

I am aware the other option is to have more (Meters) fields, then sum them
all up into the (Total Meterage) field, but I'm trying to keep the Database
as compact as possible...

It sound like an easy one.... but it ain't .... any help- much appreciated.
Thanx

Your data is not stored on the Form. It's stored in a table; the form
is just a window showing one record.

What is your table structure? Do you have a historical record of the
values of [Meters] that you wish to sum? If so, don't even think about
storing [Total Meterage] in a table; instead put a textbox on the form
with a control source

=DSum("[Meters]", "[tablename]", "<optional criteria>")

where the optional criteria let you sum only a subset of the meterage
as appropriate; e.g. if you just want the sum for this year you'ld use

"[MeterReadDate] > #" & DateSerial(Year(Date()), 1, 1) & "#"

as the criteria.

John W. Vinson[MVP]
 
Back
Top