Update Query for Multiple Records

  • Thread starter Thread starter Jonas
  • Start date Start date
J

Jonas

I want to use an update query to update multiple records. I have two
tables with unique identifiers in each one. I need to move the data
from one table to another table based on the multiple unique
identifiers. Is there a way to do this without doing a loop in VBA to
use the update query many times?
 
Substitute your table and field names. This update Table A with data in Table
B.
Here the unique identifiers field is PK in both tables.

UPDATE [Table A] INNER JOIN [Table B] ON [Table A].PK = [Table B].PK SET
[Table A].Seq1 = [Table B].[Seq1], [Table A].[Zone] = [Table B].[Zone],
[Table A].CustId = [Table B].[CustId];
 
I want to use an update query to update multiple records. I have two
tables with unique identifiers in each one. I need to move the data
from one table to another table based on the multiple unique
identifiers. Is there a way to do this without doing a loop in VBA to
use the update query many times?

Yes; appropriate criteria on the update query.

For a more detailed answer post more details of your tables and their
relationship, and what you mean by "based on the multiple unique identifiers".
 
It should be possible, but I suggest you post the SQL statement you are
now using.

Can you expand on what you mean by "multiple unique identifiers"?

It could be as simple as

UPDATE TableA INNER JOIN TableB
ON TableA.Identifier = TableB.Identifier
SET TableA.SomeField = [TableB].[SomeOtherField]

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
It should be possible, but I suggest you post the SQL statement you are
now using.

Can you expand on what you mean by "multiple unique identifiers"?

It could be as simple as

UPDATE TableA INNER JOIN TableB
ON TableA.Identifier = TableB.Identifier
SET TableA.SomeField = [TableB].[SomeOtherField]

'====================================================
  John Spencer
  Access MVP 2002-2005, 2007-2009
  The Hilltop Institute
  University of Maryland Baltimore County
'====================================================


I want to use an update query to update multiple records.  I have two
tables with unique identifiers in each one.  I need to move the data
from one table to another table based on the multiple unique
identifiers.  Is there a way to do this without doing a loop in VBA to
use the update query many times?- Hide quoted text -

- Show quoted text -

It was that simple. Thanks.
 
Back
Top