473,395 Members | 1,526 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,395 software developers and data experts.

Calculating fields in query

jlm
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 they have accumulated
throughout the year, and an accumulation factor of Annual and Sick
leave.

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].[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].

Values are not calculating as I think they should. What am I missing
here?
thanks in advance.
jlm
Nov 12 '05 #1
1 2352
for the 'second and subsequent', you may need to get the SickBalance
where max(empID) so that you do get the 'balance-at-last-occurence'.

-Paul

je************@hotmail.com (jlm) wrote in message news:<7b**************************@posting.google. com>...
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 they have accumulated
throughout the year, and an accumulation factor of Annual and Sick
leave.

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].[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].

Values are not calculating as I think they should. What am I missing
here?
thanks in advance.
jlm

Nov 12 '05 #2

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

Similar topics

1
by: Joe Bongiardina | last post by:
What does the message "calculating...." mean in the lower left status area of a form? I have a form with no calculated, concatenated or lookup fields, yet it displays this msg. The form takes...
7
by: JLM | last post by:
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...
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: Megan | last post by:
quick summary: i'm having problems trying to group fields in a report in order to calculate percentages. to calculate percentages, i'm comparing the results from my grouped fields to the totals....
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...
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...
5
by: keith | last post by:
This may seem simple, but I'm having a bit of trouble figuring out exactly how to do it. I'm accessing a database through an ODBC link, and I have a query that returns only jobs completed that day...
3
by: JDiamond | last post by:
Hi, I have a table called Hosts. The Hosts table contains the following fields: Each field represents a step in the project. The tech that completes each step initials the respective...
8
by: King | last post by:
Hi I have following MS Acess query Here is the query ID Name Prgm ID Client ID Date Start Time End Time Minutes C4 Trisha TIP DEK0703 7 /7 /2006...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.