locked
Problem with Provider - VBA + ACCESS 2010 (ADO Connections) RRS feed

  • Question

  • <g class="gr_ gr_87 gr-alert gr_gramm Punctuation only-ins replaceWithoutSep" data-gr-id="87" id="87">Hi</g> guys! I'm from brazil so forgive me about my <g class="gr_ gr_67 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="67" id="67">english</g> errors.

    It's my first time posting something here cause normally I can found the answers without a problem but now I think it's impossible

    Let's go to the <g class="gr_ gr_86 gr-alert gr_gramm Punctuation replaceWithoutSep" data-gr-id="86" id="86">problem:</g>

    <g class="gr_ gr_86 gr-alert gr_gramm Punctuation replaceWithoutSep" data-gr-id="86" id="86">I</g> have a <g class="gr_ gr_69 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="69" id="69">xlsm</g> file (excel 2010) and an access file (<g class="gr_ gr_70 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="70" id="70">accdb</g> - 2010 too) always run perfectly without a problem in the same computer where I developed at my work. So after a day without use I've returned and now <g class="gr_ gr_71 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="71" id="71">apper</g> a crazy error:

    (3076 - Provider it cannot be found. It may not be properly installed.)

    The crazy think I mentioned is cause always executed without any problem and now appear this error like I'd lost some ado.DLL I don't know.

    I work with a lot of function with <g class="gr_ gr_81 gr-alert gr_gramm Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="81" id="81">return</g> and never ... really never appear something wrong.

    I've <g class="gr_ gr_72 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="72" id="72">tryed</g> copy ALL DLL file on Program Files (x86) to he 64 <g class="gr_ gr_77 gr-alert gr_gramm Grammar multiReplace" data-gr-id="77" id="77">folder</g> and nothing, installed VB Studio and nothing, remove a lot of <g class="gr_ gr_79 gr-alert gr_gramm Grammar multiReplace" data-gr-id="79" id="79">reference</g> and nothing happen too.

    My <g class="gr_ gr_75 gr-alert gr_gramm Punctuation replaceWithoutSep" data-gr-id="75" id="75">References:</g>

    <g class="gr_ gr_75 gr-alert gr_gramm Punctuation replaceWithoutSep" data-gr-id="75" id="75">My</g> Structure for the <g class="gr_ gr_76 gr-alert gr_gramm Punctuation replaceWithoutSep" data-gr-id="76" id="76">code:</g>

    <g class="gr_ gr_76 gr-alert gr_gramm Punctuation replaceWithoutSep" data-gr-id="76" id="76">Main</g> - it's the main logic.

    <g class="gr_ gr_101 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="101" id="101">Funoes</g> - it's the module <g class="gr_ gr_162 gr-alert gr_gramm Grammar only-ins replaceWithoutSep" data-gr-id="162" id="162">where</g> have the functions logics like the code below. Most of <g class="gr_ gr_271 gr-alert gr_gramm Grammar only-ins replaceWithoutSep" data-gr-id="271" id="271">functions</g> that I have it's with <g class="gr_ gr_270 gr-alert gr_gramm Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="270" id="270">return</g> to the main module.

    all variables have a <g class="gr_ gr_300 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="300" id="300">tipograph</g> (first letter g = global / l = local) (3 sequence letters STR=string type, obj = object type ...)

    My code:

    Option Explicit
    Public goConn As ADODB.Connection
    Public goRs As ADODB.Recordset
    Public Const gstrDBName As String = "base.accdb"
    Public Const gAccessLink As String = "Provider=Microsoft.ACE.OLEDB.12.0;DATA SOURCE="
    ---------------------------------------------------------------------------------------------
    Public Function connectDatabase() As Boolean
    '//função que gera a lista de nome de serviços autorizado no userform
    '/delcaração de variaveis
        Dim lstrDB                          As String, _
            lstrPath                        As String
                    
    '/inicio da lógica
        lstrPath = ThisWorkbook.Path & "\"
        Set goConn = New ADODB.Connection
        lstrDB = gAccessLink & lstrPath & gstrDBName
        goConn.Open lstrDB       <----- here appear the error! when I try to connect
        
        If goConn.State = adStateClosed Then
            MsgBox "Sem conexão com o banco de dados!", vbCritical, "Error de Conexão"
            Set goConn = Nothing
            Exit Function
        Else
            connectDatabase = True
        End If
    End Function

    Guys, could help me? 


    • Edited by dehzin Thursday, October 29, 2015 1:42 PM
    • Moved by Fred Bao Friday, October 30, 2015 6:35 AM
    Thursday, October 29, 2015 1:39 PM

Answers