-----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(EffectiveDate)
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:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQMYEp4echKqOuFEgEQLd1QCeNOzXxdoYqYnuqdsfDTS2MX CwQcQAoK7C
Pz9nlsAGb4vx8HWdqhagNQy0
=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.