Hi. I have used a lot of times and searched this forum to fin a solution for following problem without luck:
I want to delete duplicate records from a table (Table1). I have made a query as following:
Query name: DeleteEntries
SELECT Query1.Field1, Query1.Field2
FROM Query1 INNER JOIN Query2 ON Query1.Field1 = Query2.Field1
WHERE (((Query1.Field2)="test"));
And I want to delete records in table 1 based on this query’s records from VBA.
I have made a DLookup code, but I get only one and one record and can not delete all based on DLookup:
Recs = Nz(DLookup("Field1", " DeleteEntries"))
SQLDel1 = "DELETE Table1.Field1 FROM Table1 WHERE (Table1.Field1 = """ & recs & """)"
DoCmd.RunSQL SQLDel1
Can someone help me please?
Thanks in advance.
I want to delete duplicate records from a table (Table1). I have made a query as following:
Query name: DeleteEntries
SELECT Query1.Field1, Query1.Field2
FROM Query1 INNER JOIN Query2 ON Query1.Field1 = Query2.Field1
WHERE (((Query1.Field2)="test"));
And I want to delete records in table 1 based on this query’s records from VBA.
I have made a DLookup code, but I get only one and one record and can not delete all based on DLookup:
Recs = Nz(DLookup("Field1", " DeleteEntries"))
SQLDel1 = "DELETE Table1.Field1 FROM Table1 WHERE (Table1.Field1 = """ & recs & """)"
DoCmd.RunSQL SQLDel1
Can someone help me please?
Thanks in advance.