Update table with a Running Total

K

KPR

Hi, I have a table [Table1] with the fields laid out like this...

StationID
Date
Value
CumulativeValue

What I need to do through VBA is populate the YTD [CumulativeValue] for each
[StationID] for each [Date]. The dates for each Station run from Apr 1 to Oct
1 and the [Value] field contains an Integer value for each day. So what I'm
really wanting to do is populate the YTD [Value] for each [StationID] for
each [Date].

Thanks,
Ken
 
B

Bob Barnes

Instead of storing that CumulativeValue in the Table, you can see that
thru a Query Report where you havs "From - To" dates.

HTH - Bob
 
L

Larry Daugherty

You *really* don't want to store the running total in each record in
your table. If you need to display that value, use a query and
calculate and present the figure. What would happen if you discovered
an error in December that required a correction in January? All of
the recorded values would then be wrong.

HTH
 
K

KPR

Hi Larry, this is all archived data that will never change. It's a long story
but for system performace through the web these values all need to be
pre-calculated.

Thanks,
Ken

Larry Daugherty said:
You *really* don't want to store the running total in each record in
your table. If you need to display that value, use a query and
calculate and present the figure. What would happen if you discovered
an error in December that required a correction in January? All of
the recorded values would then be wrong.

HTH
--
-Larry-
--

KPR said:
Hi, I have a table [Table1] with the fields laid out like this...

StationID
Date
Value
CumulativeValue

What I need to do through VBA is populate the YTD [CumulativeValue] for each
[StationID] for each [Date]. The dates for each Station run from Apr 1 to Oct
1 and the [Value] field contains an Integer value for each day. So what I'm
really wanting to do is populate the YTD [Value] for each [StationID] for
each [Date].

Thanks,
Ken
 
K

KPR

Hi Bob, this is all archived data that will never change. It's a long story
but for system performace through the web these values all need to be
pre-calculated.

Thanks,
Ken

Bob Barnes said:
Instead of storing that CumulativeValue in the Table, you can see that
thru a Query Report where you havs "From - To" dates.

HTH - Bob

KPR said:
Hi, I have a table [Table1] with the fields laid out like this...

StationID
Date
Value
CumulativeValue

What I need to do through VBA is populate the YTD [CumulativeValue] for each
[StationID] for each [Date]. The dates for each Station run from Apr 1 to Oct
1 and the [Value] field contains an Integer value for each day. So what I'm
really wanting to do is populate the YTD [Value] for each [StationID] for
each [Date].

Thanks,
Ken
 
B

Bob Barnes

If it MUST be done, you can write code to get the previous month's "CumTotal"
and add the required values in the current month's record to that and
populate the
current month's "CumTotal".

HTH - Bob

KPR said:
Hi Bob, this is all archived data that will never change. It's a long story
but for system performace through the web these values all need to be
pre-calculated.

Thanks,
Ken

Bob Barnes said:
Instead of storing that CumulativeValue in the Table, you can see that
thru a Query Report where you havs "From - To" dates.

HTH - Bob

KPR said:
Hi, I have a table [Table1] with the fields laid out like this...

StationID
Date
Value
CumulativeValue

What I need to do through VBA is populate the YTD [CumulativeValue] for each
[StationID] for each [Date]. The dates for each Station run from Apr 1 to Oct
1 and the [Value] field contains an Integer value for each day. So what I'm
really wanting to do is populate the YTD [Value] for each [StationID] for
each [Date].

Thanks,
Ken
 
K

KPR

That's what I'm after....the code for the VBA loop that will do this for me
Station by Station.

Bob Barnes said:
If it MUST be done, you can write code to get the previous month's "CumTotal"
and add the required values in the current month's record to that and
populate the
current month's "CumTotal".

HTH - Bob

KPR said:
Hi Bob, this is all archived data that will never change. It's a long story
but for system performace through the web these values all need to be
pre-calculated.

Thanks,
Ken

Bob Barnes said:
Instead of storing that CumulativeValue in the Table, you can see that
thru a Query Report where you havs "From - To" dates.

HTH - Bob

:

Hi, I have a table [Table1] with the fields laid out like this...

StationID
Date
Value
CumulativeValue

What I need to do through VBA is populate the YTD [CumulativeValue] for each
[StationID] for each [Date]. The dates for each Station run from Apr 1 to Oct
1 and the [Value] field contains an Integer value for each day. So what I'm
really wanting to do is populate the YTD [Value] for each [StationID] for
each [Date].

Thanks,
Ken
 
B

Bob Barnes

How are you storing each month's data?

KPR said:
That's what I'm after....the code for the VBA loop that will do this for me
Station by Station.

Bob Barnes said:
If it MUST be done, you can write code to get the previous month's "CumTotal"
and add the required values in the current month's record to that and
populate the
current month's "CumTotal".

HTH - Bob

KPR said:
Hi Bob, this is all archived data that will never change. It's a long story
but for system performace through the web these values all need to be
pre-calculated.

Thanks,
Ken

:

Instead of storing that CumulativeValue in the Table, you can see that
thru a Query Report where you havs "From - To" dates.

HTH - Bob

:

Hi, I have a table [Table1] with the fields laid out like this...

StationID
Date
Value
CumulativeValue

What I need to do through VBA is populate the YTD [CumulativeValue] for each
[StationID] for each [Date]. The dates for each Station run from Apr 1 to Oct
1 and the [Value] field contains an Integer value for each day. So what I'm
really wanting to do is populate the YTD [Value] for each [StationID] for
each [Date].

Thanks,
Ken
 

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

Top