Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MS Access 2010 Query to update one table from another

Posted on 2015-02-04
5
Medium Priority
?
222 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 300 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 1400 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 39

Assisted Solution

by:PatHartman
PatHartman earned 300 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

604 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