Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merging to tables when there is same field value

Status
Not open for further replies.

Almarton

Programmer
Jan 1, 2002
42
0
0
BR
Hi folks,

I need help to find out an easy way to merge to tables in MS Access.

There is one rule though. It is necessary to cross check a field value and when the destination table has identical field value as the source table that record (row) will be updated when not another row will be added.

Is there a built in tool to do that or do I need to make sql to create table and update else insert? Can u forward some sample code?

Thanks in advance
Alexandre Marton
Brazil.

Alexandre @lmarton Marton
almarton@task.com.br
 
There is no single SQL statement that will do this. I suggest that you run an APPEND query first. It will append records where there is no duplication of unique keys. If you have an issue with no duplication of non-unique fields then you will need to write code.

After you have done that then you can run an UPDATE query to update values in your merged table with values from the one you are merging into it. In that one you will match the tables using an INNER JOIN on primary key fields but you will not update the field (or fields) in the primary key since, by definition, they are already the same.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top