Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update records based on an identifying feild from another table(xpost)

Status
Not open for further replies.

scotent

Technical User
Mar 6, 2002
16
GB
I have a list of companies that have a currently empty field for 'Business Sector' I have another table thta contains a portion of the records that have this feild filled in. What is the best procedure for running a query that will update the fields in the new table based on the existing data in the old table?

The company names are the identifier that I can use, I am just a little puzzled as to where to start with the SQL.

Thanks in advance
 
I have been messing around with this code

UPDATE CompanyContacts
SET CompanyContacts.BusinessSector = CompanyContactsold.BusinessSector
WHERE CompanyContacts.CompanyName = CompanyContactsold.CompanyName

Not working tho.
 
Bring both tables into the query view.
Join the two based on the Company Name.
Drag the BusinessSector field from your "new" table into the grid.
Change the query to an UPDATE query.
Set UPDATE TO clause to

[CompanyContactold]![BusinessSector]

Run the query.



Remember, you're unique - just like everyone else
You're invited to visit another free Access forum:
or my site,
 
FInal version

UPDATE tblCompanies INNER JOIN test ON tblCompanies.CompanyName = test.CompanyName SET test.BusinessSector = tblCompanies.[Business Sector];

Thanksfor the help guys
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top