Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2007

    Unanswered: compare Tabels in Access with VBA

    I would like to compare two database Tables with VBA.

    Each Table has a Field of Unique IDs, so I need to check each record in both DBs with that ID. Would SQL help?

    All help and suggestions are welcomed.


  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    look at the join clause.. its going to be something like...
    select A.column1, A.column2....., B.column1.... from mytablea as A join mytablex as B on B.columnname=A.columnname

    tweaking the join will show records wich have the same userid
    show all the records in table one which aren't in tablex and vice versa

    have a look at the query qizard.. it has options that will write that query for you

    if you need to match all columns to find if they are identical then you could do that in a query or in vba. write a query which extracts all records from both tables
    iterate through that query
    then do a comparison in vba to see appropriate columns match

  3. #3
    Join Date
    Feb 2004
    One Flump in One Place
    It kind of depends what you want to know. You want to find rows in one table not in another? Or you want to find rows in both tables only? Do you care if the non-key columns match or not?

    BTW - personally I would answer all the above questions in SQL with no VBA.... but then it depends what you plan to do with the results.

  4. #4
    Join Date
    Dec 2007
    many thanks to healdem and pootle flump.

    I am really looking compare each field in the records of both Tables where those records have matching ID field values, plus identify which records have no match in the unique ID. Looks like SQL is the way to go, as per healdem. Going to be tedious, wth each record having 80 fields.

    pootle, what are your suggestions, please

  5. #5
    Join Date
    Jan 2007
    Provided Answers: 12
    A QAD solution would be to run a union (all?) query and then order by ID.
    This is the manual way of identifying differences, anyway!

    Is this a one off process?
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts