Hi all, long time no post. Good to see you all still fighting the good fight!
On to business... I use A97
Got a query which finds duplicate records in a table ( duplicates defined as having same Postcode and Surname as another record) for a given Filename ( each record is assigned a filename value on importing from a CSV file named Filename )
Problem is, the query brings back extra records which arent duplicates for the given Filename !
( The Filename is chosen by user from a cbo box). The table I am querying could contain records with the same Postcode and Surname as the recordset I am interrogating but these records will have a different Filename . Is this the problem?
Here is the SQL:
( I insert the duplicates from tblMain into tblDuplicate)
strSQL = "INSERT INTO tblDuplicate SELECT DISTINCTROW tblmain.* FROM " & _
"tbMain WHERE Filename = '" & Me.cboFilename & "' AND ((tblMain.Surname) In (SELECT [Surname] FROM " & _
"[tblMain] As Tmp GROUP BY [Surname] HAVING Count(*)>1 )) " & _
"AND ((tblMain.Postcode) In (SELECT [Postcode] " & _
"FROM [tblMain] As Tmp GROUP BY [Postcode] HAVING Count(*)>1)) "
It does find the dupes but it also brings back other records which have no duplicate for the given Filename. Help???!!!
Many thanks
npjonze
On to business... I use A97
Got a query which finds duplicate records in a table ( duplicates defined as having same Postcode and Surname as another record) for a given Filename ( each record is assigned a filename value on importing from a CSV file named Filename )
Problem is, the query brings back extra records which arent duplicates for the given Filename !

Here is the SQL:
( I insert the duplicates from tblMain into tblDuplicate)
strSQL = "INSERT INTO tblDuplicate SELECT DISTINCTROW tblmain.* FROM " & _
"tbMain WHERE Filename = '" & Me.cboFilename & "' AND ((tblMain.Surname) In (SELECT [Surname] FROM " & _
"[tblMain] As Tmp GROUP BY [Surname] HAVING Count(*)>1 )) " & _
"AND ((tblMain.Postcode) In (SELECT [Postcode] " & _
"FROM [tblMain] As Tmp GROUP BY [Postcode] HAVING Count(*)>1)) "
It does find the dupes but it also brings back other records which have no duplicate for the given Filename. Help???!!!
Many thanks
npjonze