Find Duplicate Query

M

Mary

I am trying to run a query where the value of a particular
field [LtrType] is repeated. I only need to see results
if the repeated field is the next record. If there is a
record in between the repeated fields, I don't need to see
it. I tried using the find duplicates wizard, but can't
seem to get the "next record" piece right. Can anyone
help?
 
J

John Verhagen

Assuming the table is called tblRepeat, and you have a field with unique
numbered values called ID, try the following to get the record that is
repeated the second and subsequent times:

SELECT R.ID, tblRepeat.LtrType
FROM tblRepeat, tblRepeat AS R
WHERE (((R.ID)=DMin("[ID]","tblRepeat","[tblRepeat].[ID]>" &
[tblRepeat].[ID])) AND ((tblRepeat.LtrType)=[R].[LtrType]));
 
J

John Verhagen

Does it work with a small number of records? It did on my machine. How
many records are in your table?

Mary said:
I tried this and it just clocks. Is there anything else
I can try? The Access97 database I work with is on a
network server, so that may be part of the clocking
problem, but if there's an alternate method I'd like to
try.
-----Original Message-----
Assuming the table is called tblRepeat, and you have a field with unique
numbered values called ID, try the following to get the record that is
repeated the second and subsequent times:

SELECT R.ID, tblRepeat.LtrType
FROM tblRepeat, tblRepeat AS R
WHERE (((R.ID)=DMin("[ID]","tblRepeat","[tblRepeat].[ID]
" &
[tblRepeat].[ID])) AND ((tblRepeat.LtrType)=[R]. [LtrType]));

Mary said:
I am trying to run a query where the value of a particular
field [LtrType] is repeated. I only need to see results
if the repeated field is the next record. If there is a
record in between the repeated fields, I don't need to see
it. I tried using the find duplicates wizard, but can't
seem to get the "next record" piece right. Can anyone
help?


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top