Question on Query Comparing 2 values

J

Joe C

Hello Group,

I have 2 recordsets with the 2 exact same fields. I would like to
perform a compound comparison of the 2 fields from each table. That
is; compare recordset #1 to recordset #2 and get a returned recordset
(recordset #3) that contains records where:

- Field #1 from Recordset #1 equals Field #1 from recordset #2

BUT

- Excludes records if field #2 from recordset #1 equals field #2 from
recordsets #2


I have no idea how to do this, any help is appreciated!!!

Thanks!!
 
A

Allen Browne

Perhaps you could use something like this:

Dim rs As DAO.Recordset
Dim strSql As String
strSql = "SELECT T1.* FROM T1 INNER JOIN T2 ON T1.F1 = T2.F1 WHERE T1.F2 <>
F2.F2;"
Set rs = dbEngine(0)(0).OpenRecordset(strSql)

(I'm not clear how you want to handle the nulls.)
 
J

Joe C

Perhaps you could use something like this:

Dim rs As DAO.Recordset
Dim strSql As String
strSql = "SELECT T1.* FROM T1 INNER JOIN T2 ON T1.F1 = T2.F1 WHERE T1..F2 <>
F2.F2;"
Set rs = dbEngine(0)(0).OpenRecordset(strSql)

(I'm not clear how you want to handle the nulls.)

--
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.









- Show quoted text -



Thanks! This did the trick !!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top