update table rows using key..

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

Guest

how could I update table fields from imported data..data coming in has new
field values, as well as key field to ID row to update..
do i need a loop structure i assume? any samples?
thx!
 
how could I update table fields from imported data..data coming in has new
field values, as well as key field to ID row to update..
do i need a loop structure i assume? any samples?
thx!

I answered your question this morning; did you not get the reply?

Create a Query joining your imported table to your data table, joining
on the ID field.

Make it an Update query using the Query menu option or the query-type
icon on the toolbar.

On the Update To line of the query put

[importedtablename].[fieldname]

under the field that you want to update.

Run the query.

Equivalently, write the query in SQL:

UPDATE targettablename
INNER JOIN sourcetablename
ON sourcetablename.ID = targettablename.ID
SET targettablename.FieldX = sourcetablename.FieldX;

No looping is needed nor is it appropriate.

John W. Vinson[MVP]
 
Thanks John!!

John Vinson said:
how could I update table fields from imported data..data coming in has new
field values, as well as key field to ID row to update..
do i need a loop structure i assume? any samples?
thx!

I answered your question this morning; did you not get the reply?

Create a Query joining your imported table to your data table, joining
on the ID field.

Make it an Update query using the Query menu option or the query-type
icon on the toolbar.

On the Update To line of the query put

[importedtablename].[fieldname]

under the field that you want to update.

Run the query.

Equivalently, write the query in SQL:

UPDATE targettablename
INNER JOIN sourcetablename
ON sourcetablename.ID = targettablename.ID
SET targettablename.FieldX = sourcetablename.FieldX;

No looping is needed nor is it appropriate.

John W. Vinson[MVP]
 
Back
Top