Solved

Compare 2 Table

Posted on 2000-04-19
4
155 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now