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

Access 2000 query problem - Help!



Hi, I have a problem that I'm pulling my hair out over.

I work at a company that legally has to test the blood lead levels of
it's employees.
Each person must be tested every 6 months. I have the results in a
database as shown below.
(If it doesn't show up in a fixed width font google groups users can
click the top right link to fix it)
__________________________________________________ __________________________________
| BloodTesting.mdb
|
|
|
| ___________ ___________
___________ |
| | | | | |
| |
| | EMPLOYEES | | RESULTS | |
TESTS | |
| |___________| |___________|
|___________| |
| | | | | |
| |
| | id | | id | |
id | |
| |___________| |___________|
|___________| |
| | | | | |
| |
| | name |--------------------| emp_name | |-----|
date | |
| |___________| |___________| |
|___________| |
| | | | | |
|
| | startdate | | result | |
|
| |___________| |___________| |
|
| | | | | |
|
| | leavedate | | testdate |------------|
|
| |___________| |___________|
|
| | |
|
| | untilnext |
|
| |___________|
|
|
|

|_________________________________________________ ___________________________________|

I'm trying to make a query that will show me any employee whose last
test date is more than 6 months ago (i.e. they are overdue). I can do
this easily enough for employees with only one result - select emp_name
from results where dateadd("m", 6, testdate) < date(); - but anyone
with us for more than 6 months (or employees with high lead levels in
their blood get monitored every 3 months) will have more than one
result and I'm finding it hard to query only each person's most recent
test date.

I've tried playing around qith queries and subqueries and macros and
modules and for a while I thought I'd found the key in using DISTINCT
along with "order by testdate limit 1" but that didn't work either.

Can anybody point me in the right direction on this please?

Dec 3 '05 #1
4 1103
Select EmployeeID, Max(TestDate) As LastTestDate
FROM EMPLOYEE
ORDER EMPLOYEE.EmployeeID
GROUP BY EmployeeID

Then you can get all their data using that and the original table.

Dec 3 '05 #2
Not at work now so I can't test it but my first thought is, wouldn't
that give me the most revent test date in the table rather than each
employees most recent one?

Dec 3 '05 #3
nope. That's what grouping by the EmployeeID does.

Dec 3 '05 #4

pi********@hotmail.com wrote:
nope. That's what grouping by the EmployeeID does.


Great stuff. I look forward to trying it on Monday, thanks for your
help!

Dec 3 '05 #5

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

Similar topics

3
by: cooldv | last post by:
i am running a website on Windows 2000 server with ASP 3 webpages and Access 2000 database. (with a hosting company) traffic is slow at this time but expect to grow. lately i have been reading...
24
by: jason | last post by:
Hi Ray...a while ago you explained an elegant solution to enable me to CREATE and EDIT existing tables and queries inside my online access 2000 database.... could you provide refresher links on...
2
by: Kailey11 | last post by:
This probably is a basic question for most of you, but I am setting up an very simple database - person, date traveled, location and milage - using ACCESS 2000 and I want to add up the milage in...
1
by: j.mandala | last post by:
I created a simple link between two tables in a query. TableA has Social Security numbers stored as Long Integer Data. (I imported this table). The Join is between these two fields Table ...
12
by: Bookreader | last post by:
I tried Googling this but I get a whole lot of replies about running the SQL statement in VB via ADO. All I want to do is run an existing ACCESS 2000 query from VB with no information returned...
13
by: Greg Strong | last post by:
Hello All, Hello All, What are the ToDo's / Gotchas to convert an MDB Access 2K2 database to an Access Project (i.e. ADP) file for the front end using Microsoft SQL Server 2000 Desktop Engine...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
3
by: ILCSP | last post by:
Hello, I'm fairly new to the concept of running action pass through queries (insert, update, etc.) from Access 2000. I have a SQL Server 2000 database and I'm using a Access 2K database as my...
2
by: ILCSP | last post by:
Hello, I'm in the process of changing our 'normal' Access 2000 update queries to Update Pass Through Queries. We have a SQL server 2000 database and we're using an Access 2000 database as our...
2
by: ILCSP | last post by:
Hello again, I'm still in the process of changing ms access queries to Pass through queries. We're using a SQL Server 2000 database with an Access 2000 DB as our front end. I trying to convert...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
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...

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.