ms access - How do take the value from a combobox and use it to run an SQL query -
i trying take value combo box (in case 'cbofullname' located on form 'frmmasternotebook') , cross reference table 'tblsearchengine01' update gets made column 'query05contactselect' records in column 'contact' value matches selected combobox ('cbofullname'). below code getting syntax error message.
private sub cbofullname_afterupdate() st_sql = "update tblsearchengine01, set tblsearchengine01.query05contactselect = '1' (((tblsearchengine01.[contact])=([forms]![frmmasternotebook]![cbofullname]))))" application.docmd.runsql (st_sql)
your code builds update
statement includes comma after table name ...
update tblsearchengine01, set ^
remove comma , see whether access complains else.
however suggest start creating , testing new query in access' query designer. paste statement sql view of new query ...
update tblsearchengine01 set query05contactselect = '1' [contact] = [forms]![frmmasternotebook]![cbofullname];
after revise , test statement access executes without complaint, can revise vba code produce exact same statement text works in query designer.
Comments
Post a Comment