473,406 Members | 2,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Calculating subsequent field values in table

JLM
I have a table that has fieldA, fieldB, fieldC. I want
fieldC=fieldA-fieldB. simple enough. the next record I want to be able to
do the same on the new value of fieldC.

I can do this with SAP ABAP/4, but have never done this using Access.

I'm sure this can be done, but not sure how to go about it.

thanks in advance,
jlm
Nov 12 '05 #1
7 2117
JLM wrote:
I have a table that has fieldA, fieldB, fieldC. I want
fieldC=fieldA-fieldB. simple enough. the next record I want to be able to
do the same on the new value of fieldC.

I can do this with SAP ABAP/4, but have never done this using Access.

I'm sure this can be done, but not sure how to go about it.


Storing a running sum here? As a general rule, don't store calculated
values. Produce them as you need them (in a query, on a report)
--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #2
JLM

"Bas Cost Budde" <ba*@heuveltop.org> wrote in message
news:c0***********@news2.solcon.nl...
JLM wrote:
I have a table that has fieldA, fieldB, fieldC. I want
fieldC=fieldA-fieldB. simple enough. the next record I want to be able to do the same on the new value of fieldC.

I can do this with SAP ABAP/4, but have never done this using Access.

I'm sure this can be done, but not sure how to go about it.


Storing a running sum here? As a general rule, don't store calculated
values. Produce them as you need them (in a query, on a report)
--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

I'll be needing the values later (as in months from now), so that's why I
want to keep them.
Nov 12 '05 #3
"JLM" <je**********@colostate.edu> wrote in message
news:40******@news.ColoState.EDU...

I'll be needing the values later (as in months from now), so that's why I
want to keep them.


If you will still have the values (months from now) needed to perform the
calculation you can still do so. So there is still no need to store the result
now (and many reasons not to).
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 12 '05 #4
Rick Brandt wrote:
"JLM" <je**********@colostate.edu> wrote in message
news:40******@news.ColoState.EDU...
I'll be needing the values later (as in months from now), so that's why I
want to keep them.

If you will still have the values (months from now) needed to perform the
calculation you can still do so. So there is still no need to store the result
now (and many reasons not to).

I do store 'calculated' values occasionally. Especially in an invoice, I
usually include product prices in the invoice line records. I change
prices often, but I don't like the idea that my history changes under my
fingers. (Well, if prices go up, it *would* be nice to receive the bonus
;-) ). And product descriptions for fairly the same reason.

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #5
"Bas Cost Budde" <ba*@heuveltop.org> wrote in message
news:c0**********@news2.solcon.nl...
Rick Brandt wrote:
"JLM" <je**********@colostate.edu> wrote in message
news:40******@news.ColoState.EDU...
I'll be needing the values later (as in months from now), so that's why Iwant to keep them.

If you will still have the values (months from now) needed to perform the calculation you can still do so. So there is still no need to store the result now (and many reasons not to).

I do store 'calculated' values occasionally. Especially in an invoice, I
usually include product prices in the invoice line records. I change
prices often, but I don't like the idea that my history changes under my
fingers. (Well, if prices go up, it *would* be nice to receive the bonus
;-) ). And product descriptions for fairly the same reason.


I would not consider either of those a "calculation" though.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 12 '05 #6
JLM
Let me try to be a little more specific about what I'm trying to do.

I have a form which feeds a table (TblEmpLeave) of Employee Leave Time (time
taken off for Administrative, Annual, Sick, Compensation, leave). I have
LeaveDate, LeaveType, LeaveHours fields on this form. Any employee can have
multiple entries in the table (key fields are EmpID and LeaveID) for
multiple dates (John Doe can take 3 days annual leave, then take 3 days sick
leave in any given month).

I have a BeginningBalance of hours they've accumulated throughout the year,
and an accumulation factor for Annual and Sick leave (which is another
question entirely).

I want to subtract from the BeginningBalance of LeaveType(s) for each record
in TblEmpLeave. As such, I can calculate the first occurance of leave, but
if the employee has another record in TblEmpLeave, I'm having problems
subtracting from the new value of BeginningBalance.

Sick Leave example:
for first occurance of SickLeave taken by an Employee that is appended to
TblEmpLeave;
[TblEmp].[SickBalance] = [TblEmp].[SickBalance] -
[TblEmpLeave].[SickLeaveHoursUsed]

for second and subsequent occurances of same employee in TblEmpLeave;
[TblEmp].[SickBalance] = [TblEmp].[SickBalance] -
[TblEmpLeave].[SickLeaveHoursUsed].

finally, at the end of the month, for each record in TblEmp, after
calculating all leave used;
[TblEmp].[SickBalance] = [TblEmp].[SickBalance] +
[TblEmp].[SickLeaveAccumulationFactor].

I'm pretty sure I know what I want to do (which is a good start), but not
sure how to go about it.

thanks again in advance.
jlm
"JLM" <je**********@colostate.edu> wrote in message
news:40******@news.ColoState.EDU...

"Bas Cost Budde" <ba*@heuveltop.org> wrote in message
news:c0***********@news2.solcon.nl...
JLM wrote:
I have a table that has fieldA, fieldB, fieldC. I want
fieldC=fieldA-fieldB. simple enough. the next record I want to be
able
to do the same on the new value of fieldC.

I can do this with SAP ABAP/4, but have never done this using Access.

I'm sure this can be done, but not sure how to go about it.


Storing a running sum here? As a general rule, don't store calculated
values. Produce them as you need them (in a query, on a report)
--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

I'll be needing the values later (as in months from now), so that's why I
want to keep them.

Nov 12 '05 #7
In message <40******@news.ColoState.EDU>, JLM
<je**********@colostate.edu> writes

I'll be needing the values later (as in months from now), so that's why I
want to keep them.


It sounds as if you are trying to record something line line-item values
in an invoice. Once the invoice has been raised the numbers must remain
fixed for all time. It's quite normal to store those in addition to the
data they are calculated from. When you analyse your sales figures you
don't want to have to recalculate the figures.

You can use an update query to calculate the values and store them in
the database. In the case of an invoice you may want to keep a separate
table with total values in. That saves you having to do a lot of
calculations every time you look at your sales figures.

--
Bernard Peek
London, UK. DBA, Manager, Trainer & Author. Will work for money.

Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Kasp | last post by:
Hi there, I am trying to make an OLAP cube on a table having two columns (datetime, Number_of_times_an_event_occured). My dimension is time and I want to measure the Min and Max times an event...
25
by: kie | last post by:
hello, i have a table that creates and deletes rows dynamically using createElement, appendChild, removeChild. when i have added the required amount of rows and input my data, i would like to...
1
by: jlm | last post by:
I have a form which feeds table (TblEmpLeave) of Employee Leave Time (time taken off for Administrative, Annual, Sick, Compensation leave). I have EmpID, LeaveDate, LeaveType, LeaveHours fields on...
2
by: Wayne Aprato | last post by:
I've read most, if not all, of the posts on moving average and still can't find a simple solution to my problem (if a simple solution exists!) I have a table with 2 fields: Hours and Injuries. I...
1
by: Tony Williams | last post by:
I have a table with two fields, txtvalue (a number field) and txtmonth ( a date/time field). I want to create a report that shows the difference in value between the value in txtvalue in one value...
6
by: Tony Williams | last post by:
SORRY I know we shouldn't do this but I'm desperate for an answer to this and the previous post didn't seem to get a response. I have a table with two fields, txtvalue (a number field) and...
3
by: luscus | last post by:
Thanks for all the responses on my first question. Unfortunately the answers I was given were too complicated for my small brain , and neophite condition to understand. So if you could talk down to...
10
by: tkq | last post by:
I have a normal table with customer information I have a DoB field and I want to have an automatic calculation that will show the age of the customer in another field next to it called Age ...
1
by: zoeb | last post by:
Currently I have a table, and would like the calculate a field in the table by referencing values from another 3 tables. i.e. tblData Index1, Index2, Index3, Value 1 2 3 2...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.