Results 1 to 5 of 5
  1. #1
    vetabz is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jan 2017
    Location
    Philippines
    Posts
    13

    Compare Two Tables [DETAILED PROBLEM DESCRIPTION]

    Hi,



    The problem is simple but somehow the solution eludes me!

    There's basically two structure-identical tables but one had more rows and some data(cells) in some rows are different from each other:

    shTableOne(illustrated in Excel)
    Click image for larger version. 

Name:	imgTableOne.PNG 
Views:	8 
Size:	17.1 KB 
ID:	27202

    shTableTwo(Illustrated in Excel)
    Click image for larger version. 

Name:	imgTableTwo.PNG 
Views:	8 
Size:	20.3 KB 
ID:	27203


    So I wanted to pinpoint where the changes did occur(i possible at the data level) but if not even just at the row level.

    I tried this solution: The shortest, fastest, and easiest way to compare two tables in SQL Server: UNION !
    But I could not get it to work!
    Attached the MS Access File I have worked on.
    CompareTwoTables.zip
    Last edited by vetabz; 01-24-2017 at 10:31 PM. Reason: Attachment Error

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    CompareTwoTables.zip

    I created the union table separately but I think this is what you need

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    if you actually have 20 columns to check,
    you will need 20 separate OUTER join queries , each will compare each single column
    All items in Tbl1 but missing in Tbl2

    AND (if needed) then 20 separate OUTER join queries , All items in Tbl2 but missing in Tbl1

    thats 40 queries in a macro.
    (or put all in to a single UNION query)

  4. #4
    vetabz is offline Novice
    Windows 7 64bit Access 2013 32bit
    Join Date
    Jan 2017
    Location
    Philippines
    Posts
    13
    This is awesome @andy49, awesome indeed - lost more than half of my day trying to solve this. I actually resorted to VBA (DAO) on the later part but SQL approach is much more efficient just like what you did here. Thanks a lot!!!

    I will also try to see if I could work out your suggestion @ranman256, but I think I can achieve that using @andy49's solution plus VBA(DAO).

  5. #5
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2007
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Glad it helped.


    Sent from my iPhone using Tapatalk

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 9
    Last Post: 01-24-2017, 09:10 AM
  2. need to compare two tables
    By ZeroWard in forum Access
    Replies: 1
    Last Post: 02-01-2016, 10:26 AM
  3. Replies: 1
    Last Post: 11-18-2014, 02:16 PM
  4. compare two values rounding problem
    By BCJourney in forum Queries
    Replies: 7
    Last Post: 08-06-2013, 07:27 AM
  5. Compare two tables
    By Igli in forum Access
    Replies: 2
    Last Post: 07-05-2010, 10:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums