| re: Efficient way to compare data in Two identically structured tables.
I think I discussed this a while back with Andi Plotsky. Not sure
what the subject of the discussion was, but if you search, you should
find it. In short:
You would need to join the two tables on a non-autonumber
field/fields.
Steps (if memory serves):
given tblA and tblB
1. Run "Find Unmatched" wizard on A,B.
2. Repeat with B,A.
these are the ones you definitely need to look at.
To find the inconsistent fields in the remaining records, you'd need
to do something like
- create a query that inner joins the two tables.
- loop through the records in the query
- loop through the fields collection of the querydef (so you might
want to put tblA fields first, and then the tblB fields). To do that,
you'd determine the "offset" of the second table's records. Say the
query consists of 5 fields from each table, so you'd be looking at
qdf.Fields(0) to qdf.Fields(9), so you could compare them...
really simply:
1. loop through recordset
2. loop through fields in single record
3. log non-matching values, ie. rs.Fields(n).Value <>
rs.Fields(n+OFFSET).Value
HTH,
Pieter |