Solved

Compare 2 Table

Posted on 2000-04-19
4
157 Views
Last Modified: 2010-05-02
How can I compare an old table with a new table in order to filter out the new records added to the new table.

Thanks.
0
Comment
Question by:choonfong
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
deighton earned 50 total points
ID: 2730181
Open both tables,
read new table a record a time.
do a oldtable.FindFirst on the old table looking for records matching those in new table.

if oldtable.nomatch = true then record is new

0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2730220
Hi choonfong,

A very similar question has been asked in http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10330744 
See my comments there.

You can use a similar technique on recordsets, provided they're ordered.
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 2730225
Just in case you don't know, you can get an ordered recordset quite easily by using an sql statement such as

"SELECT * FROM YOURTABLE WHERE SOMECONDITION ORDER BY UNIQUEFIELDS"

Make sure the order criteria make up a unique key otherwise you'll have trouble finding out whether two records with identical criteria are in fact the same record ;-)
0
 
LVL 2

Expert Comment

by:brice123
ID: 2730252
You could use a simple SQL statement.
For example (in MS-SQL 7) :

select
      t1.SectorID,
      t1.Description
from
      Sectors t1
left outer join
      NewSectors t2
on       t1.SectorID = t2.SectorID
where      
      t2.Description is Null
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question