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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find Duplicate Records using Recordset

Status
Not open for further replies.

Steven547

Technical User
Sep 15, 2004
165
US
Ok...I'm just starting to learn recordsets, and some examples I've found, you have to apply mods to your DB. I just need a basic duplicate record check.

I have two tables I’m comparing.
collectionDB : where the user grabs the initial data
tblBK: where the data is stored after user entry.

The fields I’m comparing are: Account Number (from collection DB) and txtAccount (from tblBK)

If the account number selected from the cbo box relating to the collection DB = any txtAccount record from tblBK, then alert there is a dupe.

I've doing a search on this forum and no luck so far. I just need a simple recordset to find dupes, that I can learn from as well. Anyone have one or where to begin?

I appreciate it.

thanks.
 
Why not simply use a query ?
SELECT *
FROM [collection DB] INNER JOIN tblBK ON [collection DB].[Account Number] = tblBK.txtAccount

Otherwise, for a single account number selected from the cbo box, you may consider the DLookUp function.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I tried the DLOOKUP, but maybe I wrote it wrong. My initial idea was to do "if DLOOKUP acount number from collection DB = DLOOKUP account from tblBK, then DUPE". But that didn't work (not sure how I wrote it but that was the basics.



 
Think I figured it out... I used your "DLOOKUP" suggestion and placed a "test" msg...and so far, when no record exists in the tblBK, it works. BUt if one exists there and the other, it says "Dupe"
'Find Duplicate record
If (DLookup("[Account Number]", "[tblCollectionDataAll]", " [Account Number]=cboAccountLookup")) = (DLookup("[Account]", "[tblBK]", " [Account]=cboAccountLookup")) Then
MsgBox "Dupe Found"
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top