JRinderer
New Member
- Joined
- Dec 1, 2015
- Messages
- 17
I got some solid advice on setting up data connections and using late binding; I've had almost no issues since then. However I have one user who is unable to run a small section of code that basically INSERTS into a database. The error message is:
Run-time error '-2147024770 (8007007e'):
Metohd 'Open' of object '_Connection' failed.
The reference library is:
Visual Basic for Applications
Microsoft Excel 15.0 Object Library
OLE Automation
Microsoft Office 15.0 Object Library
Microsoft Forms 2.0 Object Library
Microsoft ActiveX Data Object 2.0 Library
The code that is erroring out is:
For the sake of covering all bases the user is able to run the code that SELECTS from Access, which looks like:
This is the only person having this issue. To add some more confusion I've been converting some of our programs to Python, and this same user is unable to run the code there. It's the same program but in Python. I wrote a script to extract the drivers she has, and she has the necessary Access drivers.
So far from reading the information I've found on the web I can't verify any one solution. Drivers can't be the issue can they? The user is able to run the SELECT scripts without issue. I've added ActiveX 2.8 to the reference library.
Further information
User is on 32 Bit Office 2016
64 Bit OS Windows 7 Enterprise
Is it possible it's due to an Office update? The user was telling me they were skipping updates; since I'm not corporate IT I don't bother tracking down every person who doesn't update; but maybe Office is in some state of limbo since updates are being pushed off?
Run-time error '-2147024770 (8007007e'):
Metohd 'Open' of object '_Connection' failed.
The reference library is:
Visual Basic for Applications
Microsoft Excel 15.0 Object Library
OLE Automation
Microsoft Office 15.0 Object Library
Microsoft Forms 2.0 Object Library
Microsoft ActiveX Data Object 2.0 Library
The code that is erroring out is:
Code:
Dim accsApp as object
Set accsApp = CreateObject("ADODB.Connection")
accsApp.Open "Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=\\some_Shared_Location_User_Has_Access_to.accdb
For the sake of covering all bases the user is able to run the code that SELECTS from Access, which looks like:
Code:
Set accsApp = CreateObject("Access.Application")
accsApp.OpenCurrentDatabase path
userId = getDataRev("Users", userNme, "UserId", "UserName", accsApp) 'THIS FUNCTION IS BELOW IN THE NEXT CODE BLOCK
Code:
Public Function getDataRev(tble As String, idSrch As String, fldSrch As String, idFld As String, appAcc As Object) As Long
Dim rs As Object
sql = "SELECT [" & fldSrch & "] FROM " & tble & " WHERE " & idFld & "=" & Chr$(39) & idSrch & Chr$(39) & ""
Set rs = appAcc.currentdb.openrecordset(sql)
getDataRev = rs.Fields(0).Value
rs.Close
End Function
This is the only person having this issue. To add some more confusion I've been converting some of our programs to Python, and this same user is unable to run the code there. It's the same program but in Python. I wrote a script to extract the drivers she has, and she has the necessary Access drivers.
So far from reading the information I've found on the web I can't verify any one solution. Drivers can't be the issue can they? The user is able to run the SELECT scripts without issue. I've added ActiveX 2.8 to the reference library.
Further information
User is on 32 Bit Office 2016
64 Bit OS Windows 7 Enterprise
Is it possible it's due to an Office update? The user was telling me they were skipping updates; since I'm not corporate IT I don't bother tracking down every person who doesn't update; but maybe Office is in some state of limbo since updates are being pushed off?