Solved

Comparing 2 Access Tables

Posted on 2011-03-02
6
246 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
ID: 35018358
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
ID: 35018424
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
ID: 35018449
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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 2

Expert Comment

by:ghemstrom
ID: 35018493
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
ID: 35018537
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
ID: 35018626
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

This collection of functions covers all the normal rounding methods of just about any numeric value.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

822 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