Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 16th, 2004, 03:00 AM
Authorized User
Join Date: Feb 2004
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Default Delete X number of records

During the day I will add some records to my table, they have 3 fields
1. RecID (Autonum)
2. MemID (Member Number this will differ.)
3. The data to be hold
Not all MemID will get the same number of records.
What I try to achive is.
I only want to keep the last 25 rec. for each MemID.
But I do not have a clue how to construct this SQL statement.
The DB is Access 2000.
Can anyone help.


Old August 22nd, 2004, 08:24 AM
Friend of Wrox
Join Date: Aug 2004
Posts: 159
Thanks: 0
Thanked 0 Times in 0 Posts

Hello Karsten!
As a starting point u should know which Members have more than 25 records.
U solve the question running a Cross Reference Query on ur table having MemID as
rows, Date as columns, and RecID as value.Problem is that Access 2000 wont give u the total column directly. U will need to prepare two queries to have this column(Barker,F.Scott,"Microsoft Access 2000 Power Programming",pg 253,Sams Publisher).Next u pick MemID with more than 25 records using a simple query and delete the rows u dont want on ur table, one by one.
Trully Penta.

Similar Threads
Thread Thread Starter Forum Replies Last Post
delete null records stealthdevil Access VBA 3 January 23rd, 2007 04:48 PM
How to delete one of two duplicate records aarkaycee SQL Server 2000 0 August 20th, 2006 07:27 PM
Script to delete files after a set number jkutey Beginning VB 6 2 October 29th, 2005 09:45 AM
Edit or Delete records tsimsha Classic ASP Basics 6 October 30th, 2004 03:26 AM
Number of records Pharasite Classic ASP Databases 4 July 1st, 2004 02:00 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.