Update Query for Multiple Records

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?
 
K

KARL DEWEY

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];
 
J

John W. Vinson

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".
 
J

John Spencer

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
'====================================================
 
J

Jonas

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top