Solved

MS Access 2010 Query to update one table from another

Posted on 2015-02-04
5
215 Views
Last Modified: 2015-02-04
Hi ,

     I was looking for the query to update a few colums (col1,col2,col3)  in TableA   from an identical table TableB  ( where the condition TableA.PrimKey = TableB.PrimKey)

   Can you please help
0
Comment
Question by:Sam OZ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 18

Assisted Solution

by:Simon
Simon earned 75 total points
ID: 40588618
update tableA
set A.col1=B.col1, A.col2=B.col2
from tableA A inner join tableB B on A.Primkey=B.Primkey
0
 

Author Comment

by:Sam OZ
ID: 40588652
Thanks Simon . But is this tested in MS Access  ? I am getting an error   "Syntax error  Missing operator
 in query expression  from tableA  as  A inner join tableB as B on A.Primkey=B.Primkey
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 350 total points
ID: 40588653
update tableA
inner join tableB On A.Primkey=B.Primkey
set A.col1=B.col1, A.col2=B.col2
0
 
LVL 18

Expert Comment

by:Simon
ID: 40588791
Sorry, not tested on Access, and written with the wrong flavour of SQL in mind. Apologies
0
 
LVL 37

Assisted Solution

by:PatHartman
PatHartman earned 75 total points
ID: 40588795
When you don't know the correct syntax, try using the QBE to build the query.  In this case:
1. Add both tables to the grid.
2. Draw a join line to connect the two tables on the appropriate columns.
3. Select the columns from the table you want to update
4. Change the query type to Update - Access adds a new row to the grid.
5. in the update To row, type the tablename.columnname of the source data.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question