×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Access connection problem in vba 7.0

Access connection problem in vba 7.0

Access connection problem in vba 7.0

(OP)
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

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

RE: Access connection problem in vba 7.0

Your best bet is unfortunately to get away from .mdb and migrate your data to SQL Server or something like that. It's what I ended up having to do. Supposedly, if you really have 64 bit office installed (it's pretty rare), you should be able to get it to work.

-handleman, CSWP (The new, easy test)

RE: Access connection problem in vba 7.0

(OP)
I Made it work, I just replace the Jet to ACE in the provider and it work! :D
I don't know how i can make it useful and easy to find but I had a real headache trying to make it work.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources