Count New Records

  • Thread starter Matt B. via AccessMonster.com
  • Start date
M

Matt B. via AccessMonster.com

I’m trying to build a query that will compare SSN from table-1 to table-2. If
table-2 does not have the SSN’s that are on table-1, then they are NEW SSN’s
records to be added to table2.

1. How do I write a query to check for these NEW SSN’s?
2. How do I write a query that will count the New SSN’s found and list the
count in a msgbox popup?

Thanks,
Matt B.
 
C

Chris

1.
SELECT SSN FROM table1 WHERE SSN NOT IN (SELECT SSN FROM table2);

2.
Dim rst as new ADODB.RecordSet
With rst
.Open "SELECT SSN FROM table1 WHERE SSN NOT IN (SELECT SSN FROM
table2);", CurrentProject.Connection, adOpenSatic
MsgBox .RecordCount
.Close
End With
 

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