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 query 1

Status
Not open for further replies.

KimVong

IS-IT--Management
Sep 13, 2002
90
US
I have two tables, tableA have name, price field, and tableB have ID(primary key), tprice, name
I would like to update tableB and set tableB tprice = tableA price where name tableA = name in tableB, How can I make this work?
thanks
 
Look in the help files for update queries and you'll see all you need and a bit more.

Basically, you'll want to do something like this
UPDATE tableB INNER JOIN tableA On tableA.name = tableB.name SET tableB.tPrice = tableA.price

_PLEASE_ back up your data before you run this.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
thanks for the reply,
but it didn't work for me, in access, when I finish writing the query you helped me, it ask for tableA.name parameter, and tableB.name parameter.
what's wrong?
it didn't update
can you please test it out>
thanks

 
One thought is that "name" is an access reserved word. You should change the name of those fields (don't know why I didn't think about that earlier). Access probably thinks you're trying to retrieve the name property of the table.

Try that and see what happens.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.
 
Hey Jeremy
thanks, my query work now, and I do have another problem, I have will make about 10 query to update 10 field I have in tableB, would macro be a good thing to look at? So that I can just do one click, then it will update 10 of my query?
thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top