Solved

MS Access 2010 Query to update one table from another

Posted on 2015-02-04
5
210 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
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 119

Accepted Solution

by:
Rey Obrero 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 34

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

895 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now