Comparing two tables in query and highlite the changes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scotthris
    New Member
    • Oct 2006
    • 3

    Comparing two tables in query and highlite the changes

    I have two very large tables with over 16000 record sets and I need to compare two of these to determine the differences. Once the differences are identified I need to highlite them and export to Excel format.

    Can someone please give me the basic code to start this process as there are 93 fields in each record set?

    Thanks for your help
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    SELECT A.[FieldName] FROM Table1 A
    WHERE A.[FieldName] NOT IN (SELECT B.[FieldName]
    FROM Table2 B)

    This will return all records from A that don't have a corresponding value in the same field in B. Reversing it will do the opposite.


    Originally posted by scotthris
    I have two very large tables with over 16000 record sets and I need to compare two of these to determine the differences. Once the differences are identified I need to highlite them and export to Excel format.

    Can someone please give me the basic code to start this process as there are 93 fields in each record set?

    Thanks for your help

    Comment

    • scotthris
      New Member
      • Oct 2006
      • 3

      #3
      Thanks for the update, but the issue I see with this code is that it required a missing field.

      What I am looking for are different values in the same field in two tables.

      So 2 tables are exactly the same format but there has been some changes made in one table to the data stored in the fields. I need to be able to determine what field level data elements have been changed.

      Thanks for any help.

      Comment

      • MMcCarthy
        Recognized Expert MVP
        • Aug 2006
        • 14387

        #4
        That was just a sample code. If you give me the fieldnames and tablenames I will rewrite it for you



        Originally posted by scotthris
        Thanks for the update, but the issue I see with this code is that it required a missing field.

        What I am looking for are different values in the same field in two tables.

        So 2 tables are exactly the same format but there has been some changes made in one table to the data stored in the fields. I need to be able to determine what field level data elements have been changed.

        Thanks for any help.

        Comment

        • nimraj
          New Member
          • Nov 2006
          • 1

          #5
          Hi,
          Is there a way to compare two tables with 50+ fields and 1000+ records and find out the differences. The data and structure is similar. Someone could have made a change in any field in any record. A record could also have been added or removed. Just like any other text compare, can we write something in VBScript/query or module in Access to compare such tables ??

          Comment

          Working...