vba - Two records being added to table MS Access -
i have form allows user add record table when create operation button clicked 2 records added table instead of one. when add second record changed newest record added. continues happen , there 1 record in table. how go changing ?
here code using add record :
private sub save_operation_click() dim db dao.database dim rs dao.recordset strelement = me.element.value stroperation = me.operation.value strproduct = me.product_id.value strtime = me.time.value strqty = me.qty.value set db = currentdb set rs = db.openrecordset("labour", dbopentable) rs.addnew rs("element").value = strelement rs("operation").value = stroperation rs("product_id").value = strproduct rs("time").value = strtime rs("qty").value = strqty rs.update
i think problem use of "addnew" try :
with rs .addnew !element = strelement !operation = stroperation !product_id = strproduct !time = strtime !qty = strqty .update end
Comments
Post a Comment