Solved

Comparing 2 Access Tables

Posted on 2011-03-02
6
240 Views
Last Modified: 2012-06-21
I have 2 identically formatted inventory tables in Access. One created yesterday and one created today.

The old one is AITCURRENT-2011-02-28

The one from today is AITCURRENT

I would like to know what has changed from AITCURRENT-2011-02-28 to today.

For example a field called STATUS could have changed from OnShelf to OnOrder - I need to know that field changed. Also the responsible manager could have changed in the TechContact field and so on.

Thanks in advance.
0
Comment
Question by:choppa_eye
  • 3
  • 2
6 Comments
 
LVL 15

Accepted Solution

by:
derekkromm earned 125 total points
Comment Utility
Its not going to be a simple line of code.

You'll have to do something like this:

select * from ATICURRENT a inner join ATICURRENT-2011-02-28 b on
a.PK = b.PK
where
a.Field1 <> b.Field1
or a.Field2 <> b.Field2
.....
0
 

Author Comment

by:choppa_eye
Comment Utility
what is PK?

The fields I'm working with here are:

TechName
Status
InvDate

that's it just 3 fields in both tables - looking for differences.

So with that would it be

select * from AITCURRENT a inner join AITCURRENT-2011-02-28 b on a.PK = b.PK where a.TechName <> b.TechName or a.Status <> b.Status or a.InvDate <> b.InvDate

Exactly as written?
0
 
LVL 15

Expert Comment

by:derekkromm
Comment Utility
PK is primary key

So whatever your Primary Key is on that table is how you should join the 2 tables. If you have an identity column called ID or something, you'd change the "PK" to "ID". Whatever uniquely identifies the records in your table.
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 2

Expert Comment

by:ghemstrom
Comment Utility
Thinking out of the box:

Why not add a timestamp column to each record. The timestamp being updated each time the record is saved. That way you just have to compare timestamps to find updated records.
0
 

Author Comment

by:choppa_eye
Comment Utility
Derekkromm - That works, now I just have to figure out how to get it into a report so that it's easy to say

ID 1234 "changed from" On Shelf "to" On Order" :( Thanks for the help.
0
 

Author Closing Comment

by:choppa_eye
Comment Utility
I didn't understand the short hand at first - a bit more instructional would have been better, but overall it got me where I needed to go.
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

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

15 Experts available now in Live!

Get 1:1 Help Now