Solved

Compare 2 Table

Posted on 2000-04-19
4
156 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ms access #TYPE! error on report when no data 4 68
VBA color chart bars 12 79
MS Access Search and Replace Using VBA 6 59
Visual Studio 2005 text editor 10 35
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

863 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

25 Experts available now in Live!

Get 1:1 Help Now