Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking for common fields in two recordsets

Status
Not open for further replies.

mflower

MIS
May 6, 2001
52
NZ
Hi, anyone knows how I can check for common fields in two recordsets?
If rst1.ID = rst2.ID Then
MsgBox ""
Else
MsgBox "There are no matches"
End If

Why won't this code work?
 
I assume this code is after you have selected both recordsets.
If rst1.ID = rst2.ID Then
MsgBox ""
Else
MsgBox "There are no matches"
End If

Access properties, methods, objects, etc.. are referenced using the period.
rst1.EOF, rst1.RecordCount, rst1.MoveFirst

Variable names which are part of a select statement are referenced using the !
rst1!ID, rst2!ID, etc...
 
Thanks cmmrfds. Please tell me how to select the recordsets? I cant' seem to define the table in the form itself, keeps coming up with error for the table. Please help.
 
The table or select statement for a From goes in the recordsource property under the data tab for the Form.
 
looks to me like mflower might consider aggrate function like dcount() or sql

if dcount("id","rst2",rst1.id = rst2.id) then msgbox()

or

SELECT count(rst.id)
FROM rst1
INNER JOIN rst1 ON rst1.Iid = rst2.id;

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top