I am having difficulty in trying to establish a connection to an access DB from my VBA code. The code in bold is throwing up the error.
Set dbrst = New ADODB.Recordset
dbrst.ActiveConnection = GlobalConn
dbrst.CursorType = adOpenKeyset
dbrst.LockType = adLockPessimistic
dbrst.CursorLocation = adUseClient
dbrst.Open "Select * from tblResult where 0=1", _
Options:=adCmdText
dbrst.AddNew
dbrst!date_entered = Me.txtdateentered.Value
dbrst!business_area = Me.cboBusinessArea.Value
dbrst!staff_name = Me.cboStaffName.Value
dbrst!test_name = Me.cbotestName.Value
dbrst!area_manager = Me.cboAreaManager.Value
dbrst!team_leader = Me.cboTeamLead.Value
dbrst!control_total = Me.txtTotalSample.Value
dbrst!control_passed = Me.txtSamplePassed.Value
dbrst!submitted_racf = Me.txtbox.Value
dbrst!date_submitted = Me.txtDateSubmitted.Value
dbrst.Update
dbrst.Close
This is calling a module with the following
Sub SetUpVars()
On Error GoTo ConnError
GlobalConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" _
& ThisWorkbook.Path _
& "\myDB.mdb"
Set GlobalConn = New ADODB.Connection
GlobalConn.Open GlobalConnStr
Exit Sub
ConnError:
MsgBox ("Cannot find Database - EXITING APPLICATION " + vbCrLf + vbCrLf + GlobalConnStr)
End
I am getting a 3709 error, I cannot figure out for the life of me what is wrong, this codew works for another app I built but is crashing on me now, intially I thought it was reference issue but I have selected and deselected them but no luck ,any help would be appreciated, thanks
Bookmarks