ms access - INSERT INTO code returns a Compiler Error: Expected: End of Statement -


i wrote simple code insert record in test data table. followed msdn example cannot past compile error. have tried recordset , table name alone. same error.

private sub cmdcommitchg_click() 'this tester environment dim ztemp1, ztemp2, ztemp3 string  'these dummy data append table dim tblinsert string dim dbsdonors dao.database dim rcdtemptester dao.recordset  set rcdtemptester = dbsdonors.openrecordset("tbltemptester") ztemp1 = "tempid" ztemp2 = "tempentity" ztemp3 = "tempname" insert rcdtemptester!tbltemptester (id_members, id_entity, member_name) values (ztemp1, ztemp2, ztemp3)  end sub 

you mixing vba , sql. this:

private sub cmdcommitchg_click()      'this tester environment     dim ztemp1 string     dim ztemp2 string     dim ztemp3 string        dim tblinsert string     dim dbsdonors dao.database     dim rcdtemptester dao.recordset      ztemp1 = "tempid"     ztemp2 = "tempentity"     ztemp3 = "tempname"      set rcdtemptester = dbsdonors.openrecordset("tbltemptester")     rcdtemptester.addnew         rcdtemptester(ztemp1).value = <some id>         rcdtemptester(ztemp2).value = <some entity>         rcdtemptester(ztemp3).value = <some name>     rcdtemptester.update     rcdtemptester.close      set rcdtemptester = nothing     set dbsdonors = nothing  end sub 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -