You only need one connection, so remove one of those, and use the same for both recordsets. (it may be causing the problem)
Next up, why is there no "Exit Do" after the "inAlterTable = True" line? (you currently loop when there is no need!). You should then run "newRecordSet.MoveFirst" every time.
Also, you do not need two recordsets for this - just use one with SQL that joins the tables appropriately, eg:
edit: oops, this should be the SQL I think:Code:SELECT DISTINCT m.PICKSL, m.DFP, m.PROD, m.DESC FROM [MAIN] m LEFT JOIN [ALTER] a ON (a.PICKSL = m.PICKSL AND a.DFP = m.DFP AND a.PROD = m.PROD AND a.DESC = m.DESC) WHERE (a.TYPEOFCHANGE <> 'SELECTED') OR (a.PICKSL Is Null)Code:SELECT DISTINCT m.PICKSL, m.DFP, m.PROD, m.DESC FROM [MAIN] m WHERE Not Exists( SELECT * FROM [ALTER] a WHERE a.PICKSL = m.PICKSL AND a.DFP = m.DFP AND a.PROD = m.PROD AND a.DESC = m.DESC )




Reply With Quote