excel vba - run time error 3251 current recordset does not support updating -
i using excel 2007. have updated record sets in past using code don't know why start getting "run time error 3251" on one. can me find out. please.
for information, fetching data access excel vba user form & doing updation & deletion per requirement.
private sub update_finance_return_details_click() dim rs adodb.recordset dim strsql string dim mydb string dim cn object on error goto errorhandler set cn = createobject("adodb.connection") mydb = "x:\commercial\new automated invioce tracker\commercial_invoice_tracker.accdb" cn.cursorlocation = aduseserver cn .provider = "microsoft.ace.oledb.12.0" 'for *.accdb databases .connectionstring = mydb .open end set rs = new adodb.recordset if rs.state <> adstateclosed rs.close strsql = "select * [ct] [invoice_id] = " & me.id.value & "" rs.cursorlocation = aduseserver rs.open strsql, cn, adopenkeyset, adlockoptimistic rs if (me.clarification_rec_date_return.visible = true) !fin_query_dt = me.clarification_rec_date_return.value else !fin_query_dt = null end if !fin_query = me.clarification_received_finance_return.value if (me.clarification_resolve_date_return.visible = true) !fin_query_resolve_dt = me.clarification_resolve_date_return.value else !fin_query_resolve_dt = null end if !last_updated_by = environ("username") !last_updated_on = .update .close end msgbox ("record updated successfully") cleanexit: cn.close set rs = nothing set cn = nothing application.screenupdating = true exit sub errorhandler: msgbox err.description resume cleanexit end sub
i know old thread had same issue sometime ago , felt worth updating resolved me.
similar situation yourself, working fine of sudden unable write access db. issue me down migration happend , users had read ntfs access access db. giving users write ntfs access resolved issue.
Comments
Post a Comment