?
Solved

Update a table with another table data

Posted on 2012-09-04
6
Medium Priority
?
607 Views
Last Modified: 2012-09-11
I need an MS Access formula like this:

if the account on both tables are the same then update the name column with the name from table 2.                        

Table 1                  Table 2                  
                                    
Account      Name            Account      Name            
                                    
0000012                  0000012      Office             
0000013                  0000013      Meetings            
0000014                  0000014      Travel            
0000015                  0000015      Telephone            
0000016                  0000016      Events      


Thanks
0
Comment
Question by:Kdankwah
  • 3
  • 2
6 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 38364319
UPDATE Table1, Table2
SET Table1.[Name] = Table2.[Name]
WHERE Table1.Account = Table2.Account
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38364338
Alternatively:

UPDATE Table1 INNER JOIN Table2 ON Table1.Account = Table2.Account
SET Table1.[Name] = Table2.[Name]
0
 
LVL 13

Expert Comment

by:Jesus Rodriguez
ID: 38364502
that's another method

update table 2
set table2.field=table1.field
inner join table1
on table1.field=table2.field
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:Kdankwah
ID: 38387106
Unfortunately, I have to update the same table with a sort order field that I created on table 1.  This is what I have now.

UPDATE July_August INNER JOIN Accounts_table ON July_August.Account = Accounts_table.Account SET July_August.OAD_Category = Accounts_table.OAD_Category;

Its working perfectly.  Can I add another field to be updated called Sort_Order.  

I did not want to open up another ticket.


Thanks
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38387142
Like this?


UPDATE 
July_August INNER JOIN Accounts_table ON July_August.Account = Accounts_table.Account 
SET 
July_August.OAD_Category = Accounts_table.OAD_Category,
July_August.Sort_Order= Accounts_table.Sort_Order

Open in new window


<<
I did not want to open up another ticket.
>>

As a general rule you really should open seperate tickets rather than posting to closed questions.  It makes your new question visible to more people - which can result in a faster answer since the original participants might not be online, and it keeps the original question focused.
0
 

Author Comment

by:Kdankwah
ID: 38387265
Thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
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 …
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

840 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