zp*@comcast.net wrote:
....I need to loop through a record set and get the value in one
record and compare the value to the value in another record.
tia
stan
The best method would be to create a query that gets the records you
want to compare. Then open that query and select the query and the
table containing the recorfds to compare.
If this method doesn't work, then you could do it via recordsets Pseudo
code below
Sub LoopIt
Dim rst1 As Recordset
Dim rst2 As Recordset
Set rst1 = Currentdb.Openrecordset("Table1",dbopensnapshot)
Set rst1 = Currentdb.Openrecordset("Table2",dbopensnapshot)
Do while not rst1.EOF
If whatever is your criteria in this record determines it should
be compared to table 2 then
rst2.FindFirst "whatever values are required to find the
record in table2"
If not rst2.NoMatch then
if rst2!Field <> rst1.Field then
msgbox "No Match"
endif
else
msgbox "Not in table 2 values in table 1 are : &
rst!whatever values
endif
endif
rst1.movenext
loop
rst1.close
rst2.close
set rst1 = Nothing
set rst2 = Nothing
end sub