Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting Records based on record number

Status
Not open for further replies.

Raptor136

Technical User
Aug 26, 2002
39
US
Hi all,
Here's a poser.
I have a table that has either 1 or two records with the same info. If I have only 1, then fine. If I have two, then I want to keep the second. example

Fld1 Fld2 Fld3
AAAA xxxx nnnn
AAAA 1234 3456
BBBB uuuu jjjj
CCCC oooo 9999
CCCC pppp 8765

I would want to keep the second instance where Fld1 = AAAA and CCCC. The first instance of each can be safely deleted.
I also want to keep the *only* instance of BBBB.

All help appreciated. Thanks
Phil raptor136@adelphia.net
 
Hi

In an Access table there is no 'record number' as such, the rows are considered as an unordered list.

To achive Order, you first need a query with an Order By clause to Order your rows in a predictable order so that you can determine which row you wish to delete Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
I understand what you are saying. In the actual tables, I have an autonumber ID as primary key. I can create a Select Query that orders by ID. Once they are in order, Fld1 will sometimes be repeated. The second instance of matching data in Fld1 will always be kept. Does this make sense? Thanks for the reply.

Phil raptor136@adelphia.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top