A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Question on Query Comparing 2 values



 
 
Thread Tools Display Modes
  #1  
Old July 10th, 2008, 04:20 PM posted to microsoft.public.access.queries
Joe C
external usenet poster
 
Posts: 5
Default Question on Query Comparing 2 values

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 whe

- 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!!
  #2  
Old July 10th, 2008, 04:36 PM posted to microsoft.public.access.queries
Allen Browne
external usenet poster
 
Posts: 11,706
Default Question on Query Comparing 2 values

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.

"Joe C" wrote in message
...

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 whe

- 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


  #3  
Old July 10th, 2008, 05:58 PM posted to microsoft.public.access.queries
Joe C
external usenet poster
 
Posts: 5
Default Question on Query Comparing 2 values

On Jul 10, 11:36*am, "Allen Browne"
wrote:
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.

"Joe C" wrote in message

...





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 whe


- *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- Hide quoted text -


- Show quoted text -




Thanks! This did the trick !!!
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:37 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.