packmen
Mechanical
- Aug 31, 2001
- 77
Hi all.
I'm upgrading to solidworks 2014 but I must connect to a Access file first and I'm getting a "Provider not found" error '3706' in the last line of the code.
I needed to add PtrSafe in the code so the rest is working, but the code below aren't.
I change the Provider=Microsoft.Jet.OLEDB.4.0 to Provider=Microsoft.Jet.OLEDB.12.0 and my Office's version is 14.0.7015.1000 (64 bits). I also added the "Microsoft Access 14.0 Object Library" reference in vba 7
can't someone point me the right direction?
thanks
Emerson BB
I'm upgrading to solidworks 2014 but I must connect to a Access file first and I'm getting a "Provider not found" error '3706' in the last line of the code.
I needed to add PtrSafe in the code so the rest is working, but the code below aren't.
I change the Provider=Microsoft.Jet.OLEDB.4.0 to Provider=Microsoft.Jet.OLEDB.12.0 and my Office's version is 14.0.7015.1000 (64 bits). I also added the "Microsoft Access 14.0 Object Library" reference in vba 7
Code:
Function GetNewDBCode(sName As String, sOldCode As String, sMachineName As String) As String
Dim sReturn As String
Dim sOldName As String
'Define the three objects that we need,
' A Connection Object - connects to our data source
' A Command Object - defines what data to get from the data source
' A RecordSet Object - stores the data we get from our data source
Dim conConnection As New ADODB.Connection
Dim cmdCommand As New ADODB.Command
Dim rstRecordSet As New ADODB.Recordset
'Defines the connection string for the Connection. Here we have used fields
'Provider, Data Source and Mode to assign values to the properties
' conConnection.Provider and conConnection.Mode
conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.12.0;Data Source=" & "X:\CADASTRO DE MATERIAIS.mdb;Mode=Read|Write"
'Define the location of the cursor engine, in this case we are opening an Access database
'and adUseClient is our only choice.
conConnection.CursorLocation = adUseClient
'Opens our connection using the password "Admin" to access the database. If there was no password
'protection on the database this field could be left out.
conConnection.Open
can't someone point me the right direction?
thanks
Emerson BB