sql - 3146 ODBC Call Failed - Access 2010 -



sql - 3146 ODBC Call Failed - Access 2010 -

please reference code below...

private sub save_click() on error goto err_i9_menu dim dba database dim dba2 database dim rst recordset dim rst1 recordset dim rst2 recordset dim rst3 recordset dim sql string dim dateandtime string dim filesuffix string dim folder string dim strpathname string dim x integer x = instrrev(me!listcontents, "\") phone call myprocess(true) folder = dlookup("[folder]", "locaton", "[loc_id] = '" & forms!frmutility![site].value & "'") strpathname = "\\reman\plantreports\" & folder & "\hr\paperless\" dateandtime = getdatetime() if nz(listcontents, "") <> "" set dba = currentdb filesuffix = mid(me!listcontents, instrrev(me!listcontents, "."), 4) sql = "select extension tbl_forms type = 'i-9'" sql = sql & " , action = 'submit'" set rst1 = dba.openrecordset(sql, dbopendynaset, dbseechanges) if not rst1.eof newname = me!divisionnumber & "-" & right(me!ssn, 4) & "-" & lastname & dateandtime & rst1.fields("extension") & filesuffix else newname = me!divisionnumber & "-" & right(me!ssn, 4) & "-" & lastname & dateandtime & filesuffix end if set moveit = createobject("scripting.filesystemobject") copyto = strpathname & newname moveit.movefile me.listcontents, copyto set rst = nil set dba = nil end if if nz(listcontentshq, "") <> "" set dba2 = currentdb filesuffix = mid(me.listcontentshq, instrrev(me.listcontentshq, "."), 4) sql = "select extension tbl_forms type = 'healthquestionnaire'" sql = sql & " , action = 'submit'" set rst3 = dba2.openrecordset(sql, dbopendynaset, dbseechanges) if not rst3.eof newname = me!divisionnumber & "-" & right(me!ssn, 4) & "-" & lastname & dateandtime & rst3.fields("extension") & filesuffix else newname = me!divisionnumber & "-" & right(me!ssn, 4) & "-" & lastname & dateandtime & filesuffix end if set moveit = createobject("scripting.filesystemobject") copyto = strpathname & newname moveit.movefile me.listcontentshq, copyto set rst2 = nil set dba2 = nil end if set dba = currentdb set rst = dba.openrecordset("dbo_tbl_employmentlog", dbopendynaset, dbseechanges) rst.addnew rst.fields("transactiondate") = date rst.fields("employeename") = me.lastname rst.fields("employeessn") = me.ssn rst.fields("employeedob") = me.employeedob rst.fields("i9pathname") = strpathname rst.fields("i9filesent") = newname rst.fields("site") = dlookup("folder", "locaton", "loc_id='" & forms!frmutility!site & "'") rst.fields("userid") = forms!frmutility!user_id rst.fields("hqpathname") = strpathname rst.fields("hqfilesent") = newname2 rst.update set dba = nil set rst = nil exit_i9_menu: phone call myprocess(false) divisionnumber = "" lastname = "" ssn = "" listcontents = "" listcontentshq = "" exit sub err_i9_menu: phone call myprocess(false) msgbox err.number & " " & err.description 'msgbox "the programme has encountered error , info not saved." exit sub end sub

i maintain getting odbc phone call error. permissions right , previous piece of code worked there separate tables i9 , hq logs. routine called when submits set of files specific information.

just guess here, i'm thinking you've got typo that's resulting in assigning null required field.

change "locaton":

rst.fields("site") = dlookup("folder", "locaton", "loc_id='" & forms!frmutility!site & "'")

to "location":

rst.fields("site") = dlookup("folder", "location", "loc_id='" & forms!frmutility!site & "'")

some general advice troubleshooting 3146 odbc errors: dao has errors collection contains more specific info odbc errors. next quick , dirty way see what's in there. have more refined version of in standard error handling module include in of programs:

dim long = 0 errors.count - 1 debug.print errors(i).number, errors(i).description next

sql ms-access odbc subroutine

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

SQL Server : need assitance parsing delimted data and returning a long concatenated string -