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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I create an update query to update fields based on another tabl 2

Status
Not open for further replies.

SeeWard

Programmer
Mar 21, 2005
89
0
0
US
Hi,
I don't know if this can be done in Access, but I would like to be able to update records that contain city and county fields. The proper cities and counties reside in a different table than the main table. Is there a way I can create an update query that would pull the right cities and counties.
 
Me again!
I thought I should rephrase the question. How would I go about creating an update query that would update fields in a table based on fields in another table.
I have addresses ...but these addresses contain the wrong counties. I have a table that has all the cities and their corresponding counties. I would like to match the cities and update the counties field. How would I do this please?
Thanks!
 
Something like this ?
UPDATE tblAddresses INNER JOIN tblCounties ON tblAddresses.City = tblCounties.City
SET tblAddresses.County = tblCounties.County

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
If your table of "cities and their corresponding counties" has a primary key of the city, you can create a query with both tables. Join the City fields. Change the query to an update query and update the county with the county from the city/county table.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Thanks to you both! It works perfectly well and does exactly what I needed it to do!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top