473,657 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Uosing different rates for employees in various stages

Hi to all
I am building a database to track project expenses information. My
database has 4 main tables, Employees, Activity, project info and
rates.

We add a project and track activities on the project. Each employee
will add an activity on a certain date. What I need to do is check the
date the activity was added and then check what the rate is that
employee was paid during that period.

I am thinking in the lines of a vlookup in excel, but can't seem to
find a similiar function in access. I simply want to add an employee
increase/decrease rate in the rates table. Then, when I add an
activity for a date, it should match the activity date with the rate
date, rounding down (as a vlookup does) and use that rate.

Any assistance in this matter would be appreciated. This will save me
hours of check 10 years worth of activity rates.

Kind regards,

Eddie
Nov 13 '05 #1
3 1599
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You'll have to use a subquery to find the Rate in the correct date
range. E.g., say you wanted to find an employee's Rate for the date
Oct. 31, 2002, you'd use a query like this:

SELECT E.EmployeeName, R.Rate
FROM Employees As E INNER JOIN Rates As R
ON E.EmployeeID = R.EmployeeID
WHERE R.EffectiveDate = (SELECT MAX(EffectiveDa te)
FROM Rates WHERE EmployeeID = E.EmployeeID
AND EffectiveDate <= #10/31/2002#)
AND EmployeeID = 2566

The subquery gets the last effective date that is on, or before, Oct.
31, 2002. The main query uses this date to get the Rate that was
entered on that date.

The above assumes the Rates table is structured similar to this:

EmployeeID, EffectiveDate, Rate
< number > < date > < currency or double >

--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQMYEp4echKq OuFEgEQLd1QCeNO zXxdoYqYnuqdsfD TS2MXCwQcQAoK7C
Pz9nlsAGb4vx8HW dqhagNQy0
=hyxy
-----END PGP SIGNATURE-----

Eddie wrote:
Hi to all
I am building a database to track project expenses information. My
database has 4 main tables, Employees, Activity, project info and
rates.

We add a project and track activities on the project. Each employee
will add an activity on a certain date. What I need to do is check the
date the activity was added and then check what the rate is that
employee was paid during that period.

I am thinking in the lines of a vlookup in excel, but can't seem to
find a similiar function in access. I simply want to add an employee
increase/decrease rate in the rates table. Then, when I add an
activity for a date, it should match the activity date with the rate
date, rounding down (as a vlookup does) and use that rate.

Any assistance in this matter would be appreciated. This will save me
hours of check 10 years worth of activity rates.


Nov 13 '05 #2
Thanks a million! I really appreciate the help on the sub query. This
works fine and all my records are accurate. I can't say that I
understand the statement quite, but this is what it looks like. Could
you explain the section from where the sub query kicks in. That would
be great. Thanks a million again

Regards,

Eddie

SELECT employees.Name, rates.rate, Activity.Activi tydate,
Activity.Projec tName, Activity.Hours, [Hours]*[rate] AS [Total
Activity Cost]
FROM (employees RIGHT JOIN Activity ON employees.empid =
Activity.Empid) LEFT JOIN rates ON employees.empid = rates.empid
WHERE (((rates.effect ivedate)=(SELEC T MAX(EffectiveDa te)
FROM Rates WHERE EmpID = Employees.EmpID
AND EffectiveDate <= activity.activi tydate)));
Nov 13 '05 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The subquery selects the date that is on, or before, the Activity Date,
for all the Employees. E.g.: You want to find the latest EffectiveDate
that is on, or before, Oct. 14, 2003. If an employee's Effective dates
are like this:

EffectiveDate
6/15/2001
7/1/2002
7/1/2003 <-
8/1/2004

then 7/1/2003 is the date selected as the Max(EffectiveDa te). IOW,
7/1/2003 is the highest (MAX) date before 10/14/2003 in that employee's
list of EffectiveDates.

Since there is only one Rate for that employee on that EffectiveDate (or
should be only one Rate) the main query uses the employee's Rate that is
on the EffectiveDate selected by the subquery.

HTH,

--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQMfeKIechKq OuFEgEQLmDQCgkC tBVhrWFoXrZEExg PhiOhyyrWAAoInJ
a97YcA7iFoCe5Cn JG5PUnsRD
=JHV3
-----END PGP SIGNATURE-----
Eddie wrote:
Thanks a million! I really appreciate the help on the sub query. This
works fine and all my records are accurate. I can't say that I
understand the statement quite, but this is what it looks like. Could
you explain the section from where the sub query kicks in. That would
be great. Thanks a million again

Regards,

Eddie

SELECT employees.Name, rates.rate, Activity.Activi tydate,
Activity.Projec tName, Activity.Hours, [Hours]*[rate] AS [Total
Activity Cost]
FROM (employees RIGHT JOIN Activity ON employees.empid =
Activity.Empid) LEFT JOIN rates ON employees.empid = rates.empid
WHERE (((rates.effect ivedate)=(SELEC T MAX(EffectiveDa te)
FROM Rates WHERE EmpID = Employees.EmpID
AND EffectiveDate <= activity.activi tydate)));


Nov 13 '05 #4

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

Similar topics

5
1701
by: Eddie | last post by:
I have an Access database that tracks project information. The database is very simple, except for 1 small aspect. Some background: 4 Tables - Project information, Employees, activity and pay rates. The user will add an activity to a project. The activity will take place on a date, so they will enter the date it took place and the hours worked. The problem is that the employee might get an increase during the project, which will need...
1
1332
by: Zurghew | last post by:
Hello all, I have just created a database (partially) which will bill customers for work done. However I am stuck when it is comes to different rates for different works. REQUIRED: What I intent to have is a form in which I will enter the customer order no: and then in the subform choose the work done and then based on the work input calculate the rates and have it billed to the customer. I have no idea on how to have the rates...
3
2262
by: michb | last post by:
I need to be able to calculate on a daily basis, both normal and overtime hours for both payroll and job costing. I also then need to calculate the above on a weekly basis, in order to complete the payroll. I have employee normal, time/half and double time rates in $value in one table, then in another I have log in and out times; then another job start and stop time. I realize the code is probably logical-but I am not brilliant with
2
2027
by: Chad Richardson | last post by:
I would like a single SQL to return all employee's total billable compensation for a year. Their billable rates change throughout the year so under the employee table (one), there is a compensation table (to many) which has the employee id, effective date, billable hourly rate. So in a given year calendar year they could have many different (though usually 2 at most) rates. These rates then have to correspond to and e multiplied by their...
3
2724
by: milam | last post by:
Greetings, I would like to use a query result as a column name in another query, I can't seem to get this to work using Subqueries. Is there a good way to do this? Example: Table "Employees": Name Title
1
1799
by: webcm123 | last post by:
I'm looking for a good method of securing ratings. Cookies lock isn't sufficient. In addition to cookies I would need something else. I'm introducing some ways. -= Storing rates inside seperate tables =- Seperate tables (artrates, filerates, imgrates) will contain: ID of item | rate | user | IP 1 rate = 1 record. Field USER will filled if only registered users can
4
5376
by: kneielj | last post by:
what are the various stages in generating an object file (.o) from a .c file and then moving on to link the .o 's and libs (.a's) to form an executable? the first step would be preprocesing. what after that ? when does assembly , compilation come into play ? any links where i could read upon how this entire process from .c to executable works ?
7
1768
by: Michel Couche | last post by:
Hello, I am working on a project for a potential customer. The project will basically involve an ASP.Net 2.0 application and a database (ideally MS SQL). The customer has already a hosting plan but it does not currently include a MS SQL database. This option is offered as a rather expensive add-on (600 US $ /year). If we need cost saving, I could offer to set-up a MS SQL 2005 DB on my own
1
1566
by: gareth | last post by:
Hello I am looking for some help with table structure design, i am creating a database which manages data on loft and cavity wall insulation done by various contractors. The database uses look up tables to work out how much energy is expected to be saved over the lifetime of the householder in GWh by the individual measure installed using data like the type of house and the type of fuel used to heat the home. The monetary value of the work is...
0
8392
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
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8603
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
6163
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
5632
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
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1604
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.