Updating query from one atable to another table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two tables with the same structure.

I want to run a query from one table to the other to update any records
that have changes.
But I can not get the Update query to work?
How can I get this to work?
 
I have two tables with the same structure.

Then I suspect you have a poorly designed database. Why store the same
data redundantly in two tables, giving you the very update anomalies
you're now trying to fix?
I want to run a query from one table to the other to update any records
that have changes.
But I can not get the Update query to work?
How can I get this to work?

You'll need to Join the two tables, primary key to primary key. (If
they don't have a primary key you're out of luck).

Select all the fields in both tables. Put a criterion on each field of
the second table

<> [FirstTable].[fieldname]

using the actual table and field names of course. Put each criterion
on a SEPARATE line of the query design grid, to use OR logic.

Change it to an Update query and update each first table field to

[SecondTable].[fieldname]

again using the real name of the table and the field.


John W. Vinson[MVP]
 
I have two tables.
A master and an edit table. They have the identical structures.
I pull out a group of records from the master table and place them into the
edit table.
What I need to do is after the user has finished their changes to the
records in the edit table.
I need to then update the sames records in the master table.

I have not bee able to get the query update to work.

Can anyone help get the query update to work correctly.

My alternative is to delete the recorda from the master and append the
edited record to the master?
Which is more work then I should be needed.


John Vinson said:
I have two tables with the same structure.

Then I suspect you have a poorly designed database. Why store the same
data redundantly in two tables, giving you the very update anomalies
you're now trying to fix?
I want to run a query from one table to the other to update any records
that have changes.
But I can not get the Update query to work?
How can I get this to work?

You'll need to Join the two tables, primary key to primary key. (If
they don't have a primary key you're out of luck).

Select all the fields in both tables. Put a criterion on each field of
the second table

<> [FirstTable].[fieldname]

using the actual table and field names of course. Put each criterion
on a SEPARATE line of the query design grid, to use OR logic.

Change it to an Update query and update each first table field to

[SecondTable].[fieldname]

again using the real name of the table and the field.


John W. Vinson[MVP]
 
I need to then update the sames records in the master table.

I have not bee able to get the query update to work.

Can anyone help get the query update to work correctly.

Not unless you give us some help.

Please post the SQL view of your current update query, and tell us in
what way it is "not working".

John W. Vinson[MVP]
 
Back
Top