Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 23rd, 2005, 07:47 AM
scottybob scottybob is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 1 scottybob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 39 m 26 sec
Reputation Power: 0
Top 3 query

Hi

I'm a newbie to access development. I have a table which lists records of employees monitoring. Each record has Id, date , name etc. What I want is, for any one month, to select three of the last records for all employees. So if employees have, say, six records I only want to display the last three of them (by date). I can work out most of the criteria to filter the records the way I want however I am not sure how to do this part of it. Can anyone help?

Thanks in advance

Reply With Quote
  #2  
Old June 24th, 2005, 04:26 AM
DanSimp DanSimp is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 11 DanSimp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 45 sec
Reputation Power: 0
use the dlast function in a bit of vb code to lookup the table row identifier of each of the last 3 records, e.g.

getkey = dlast("[keyfieldname]","[tablename]","criteria to be met")

to get the last 3, you might wish to use a loop. You may also wish to use the dcount function to ensure that there is at least 3 records.

If you need the exact code, then let me know the table definition.

regards,
Dan

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Top 3 query


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT