access vba - Run-Time error '3075' when using sql UPDATE SET FROM WHERE -


i did simple syntax error. couldn't find similar on web i'm asking guys here.

i'm trying update field 'true' if there match between 2 columns in 2 different tables, example

table1: cat selected    table2: cat          1   false               2          2   false               3 

then "selected" field "2" changed true:

table1: cat selected    table2: cat          1   false               2          2   true                3 

i'm using following sql code:

docmd.runsql "update table1 set table1.selected=-1 " & _               "from table2, table1 " & _                "where table1.cat=table2.cat" 

and i'm getting error '3075' say:

syntax error (missing operator) in query expression '-1 table2'.  

when i'm removing from statement, problem disappear, i'm writing values table2 manually.

hope can help, thank in advance.

i think solved doing:

docmd.runsql "update table1, table2 set table1.selected=-1 " & _              "where table1.cat=table2.cat" 

though i'm not updating table2, adding after "update" solved problem. if have better ideas, know.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -