vba - Two records being added to table MS Access -


two records

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 

enter image description here

i think problem use of "addnew" try :

with rs    .addnew    !element = strelement    !operation = stroperation    !product_id = strproduct    !time = strtime    !qty = strqty    .update end 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -