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

How to update rows in one table depending on another table 1

Status
Not open for further replies.

JohnMusbach

Technical User
Jun 26, 2008
2
US
This is a follow up to the closed thread thread700-1241490.

Hi, I have one table (Geocodes) who has identical fields as another table (PROJDES1) except that its fields have updated contents and I would like to merge the fields contents into the other table (PROJDES1) without touching the other fields in that table. I am attempting to do this with the following code:

Code:
DoCmd.RunSQL "UPDATE Geocodes INNER JOIN PROJDES1 " & _
       "ON 'Geocodes.Project #' = 'PROJDES1.Project #' " & _
"Set Geocodes.LAT = PROJDES1.LAT " & _
"WHERE Geocodes.LAT <> PROJDES1.LAT " & _
   "OR PROJDES1.LAT IS NULL " & _
   "OR Geocodes.LAT IS NULL"
But when I run the function access says "Join expression not supported.", what am I doing wrong? Thanks! :)
 
looks like you've got some extra ' marks and missing the correct delimiter for names with spaces:
Code:
DoCmd.RunSQL "UPDATE Geocodes INNER JOIN PROJDES1 " & _
       "ON Geocodes.[Project #] = PROJDES1.[Project #] " & _
"Set Geocodes.LAT = PROJDES1.LAT " & _
"WHERE Geocodes.LAT <> PROJDES1.LAT " & _
   "OR PROJDES1.LAT IS NULL " & _
   "OR Geocodes.LAT IS NULL"

now you know the only field that is going to change is PROJDES1.LAT, right?

Leslie

Have you met Hardy Heron?
 
Yep I'm aware of that and thanks, your corrections have fixed the code. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top