Results 1 to 4 of 4
  1. #1
    slimjen is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    727

    compare field data in two tables

    All; I inherited a database that has two tables that are structured identical;
    one called tblcurrentdata and the other called tblpriordata. The user wants a
    report or export query that only shows records that has differences between
    prior weeks data and the current weeks data. The tables have 12 fields of data
    in a record per quote number. The user wants a query or report to identify the
    QuoteNum and any changes between the prior and current records. The table
    structures are as follows:

    Code:
    tblCurrentData/tblPriorData:
    QuoteNum 
    CoName
    State
    ZipcodeNo
    priorityColor
    CreateDte
    ModifyDte
    POC
    GrossWges
    NetWges
    SubsidyAmt
    BonusAmt
    For ex.:
    QuoteNum 12345
    field 5 (prioritycolor) changed from red in the prior week to green in the
    current week and field 7(POC) changed from Scott in the prior week to Jonson in
    the current week . The user wants to know this.
    QuoteNum 23451 did not have
    any changes therefore does not need to be listed in the
    query/report
    Simply put; compare one table to the other and see whats different right.

    Unmatched query doesn’t work because it does not compare
    multiple fields. I tried to structure a union query and use <> in each
    field but got too tedious and didn’t give the expected results. Does anyone know
    of vba code maybe to loop through the fields solution to get these results? Thanks

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by slimjen View Post
    Unmatched query doesn’t work because it does not compare
    multiple fields...
    It is possible to create multiple Joins. Just be sure to add the Is Null criteria to the additional fields and get the Left Join vs. Right Join thing correct

  3. #3
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    inner join between current and prior on quotenum and 'or' for the criteria

    then in criteria

    for tblcurrent.coName column put <>tblprior.coName
    on the next line down for tblcurrent.state column put <> tblprior.state
    on the next line down for tblcurrent.zipcode column put <> tblprior.zipcode
    etc

  4. #4
    knarfreppep is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Feb 2015
    Location
    Adelaide, Australia
    Posts
    106

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

Similar Threads

  1. Macro to parse data and compare tables
    By twckfa16 in forum Programming
    Replies: 3
    Last Post: 01-05-2015, 03:24 PM
  2. Using Access to Compare Tables
    By britsgal in forum Access
    Replies: 1
    Last Post: 04-03-2014, 04:16 PM
  3. Replies: 4
    Last Post: 11-21-2012, 03:17 PM
  4. Compare Data in Multiple Tables
    By Access_newbie in forum Queries
    Replies: 7
    Last Post: 07-26-2011, 11:35 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