473,789 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2182
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.solco n.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**********@c olostate.edu> wrote in message
news:40******@n ews.ColoState.E DU...

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**********@c olostate.edu> wrote in message
news:40******@n ews.ColoState.E DU...
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**********@c olostate.edu> wrote in message
news:40******@n ews.ColoState.E DU...
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 "calculatio n" 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 BeginningBalanc e 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 BeginningBalanc e 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 BeginningBalanc e.

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

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

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

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**********@c olostate.edu> wrote in message
news:40******@n ews.ColoState.E DU...

"Bas Cost Budde" <ba*@heuveltop. org> wrote in message
news:c0******** ***@news2.solco n.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**********@c olostate.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
2274
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 occured over time. I have no problem in calculating Maximum occurance of events over time. However, I have some NULL values in my Number_of_times_an_event_occured column, due to which I don't see any result when I try to calculate
25
5199
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 calculate the totals in each row. when i try however, i receive the error: "Error: 'elements' is null or not an object"
1
2380
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 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 that...
2
13608
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 have a query based on this table which shows these 2 fields and calculates a third field: Frequency Rate, based on a formula which uses the Hours and Injuries fields. Is there a simple way of A: using yet another calculated field in the query...
1
4310
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 of txtmonth and the value of txtvalue in another value of txtmonth and the percentage increase . For example if I have the value 1000 in 30/03/03 and the value 1100 in 30/03/04 How do I calculate the difference as 100 and the increase as 10%. I...
6
3382
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 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 of txtmonth and the value of txtvalue in another value of txtmonth and the percentage increase . For example if I...
3
2723
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 me and write in easier terms I would be very gratefull to all you access wizards! Here is my problem. I have a table with maybe 10 fields, It is used to imput information taken over the phone to solve patient problems in our Spanish...
10
47868
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 Could you please help me with this Thanx all
1
2180
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 2 2 1 3 4 and tblIndex1 Value Data 1 2.5
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10139
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.