Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    29

    Question Unanswered: HELP?!: Mystery OLE DB Provider Error

    I am getting a mystery message on my PC at home while trying to execute code that I KNOW works at the office, but when I get it home... Error, Error, Error.

    '**********************************
    '**********************************
    '*** System information & Troubleshooting thus far.
    '**********************************
    '**********************************
    WinXP Prof. SP 2
    SQL Server 2000 SP 3
    Office 2002
    Office Developer 2002

    -Checked for incorrect reference libraries in VBA
    -Checked MDAC 2.8 componants
    -Formatted and re-installed box
    -Checked MSDN for error
    -Googled like mad


    '**********************************
    '**********************************
    '*** Connection Strings (these are the global connect strings I use
    '*** they sit in a separate module from the rest of my code.)
    '*** Note: They all work at WaMu but they all give an error at Home.
    '*** I comment them out depending on what connection I want to use.
    '**********************************
    '**********************************

    '*** @Work MDB ***
    Public Const strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=C:\Documents and Settings\UserNbr\Desktop\FlowApp\Data\FileFlow(Dat a).DTA;" & _
    "Jet OLEDB:Database Password=password"

    '*** @Home MDB ***
    'Public Const strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    '"Data Source=C:\Documents and Settings\FName LName\Desktop\FlowApp\FileFlow(Data).DTA;" & _
    '"Jet OLEDB:Database Password=password"

    '*** @Work SQL ***
    'Public Const strConn As String = "Provider=sqloledb;" & _
    '"Data Source=SQLServerName;" & _
    '"Initial Catalog=Development;" & _
    '"User Id=Client;" & _
    '"Password=Password"


    '***********************************
    '***********************************
    '*** Here is the code I'm using to open the recordset and bind the control.
    '***
    '***
    '***********************************
    '***********************************
    Option Compare Database
    Private cnnLookup As New ADODB.Connection
    Private rstLookup As New ADODB.Recordset
    '_________________________________________________ _____________
    Private Sub PopulateSrchResults()
    Dim strSrchLoanNbr As String
    Dim strSrchCHKey As String
    Dim strSrchBorrLName As String
    Dim strSrchSoc As String
    Dim strSrchOldLoanNbr As String
    Dim strSQL As String
    'Re-initialize recordset and connection
    Set cnnLookup = Nothing
    Set rstLookup = Nothing
    'Disable Navigation controls
    Me!cmdOpenLoanDetail.Enabled = False
    Me!cmdOpenTaskOvrRd.Enabled = False
    'Set connection
    cnnLookup.Open strConn 'Reference to global connection string.
    strSQL = "SQL "
    With rstLookup
    Set .ActiveConnection = cnnLookup
    .CursorType = adOpenStatic
    .CursorLocation = adUseClient
    .LockType = adLockReadOnly
    .Open strSQL
    End With
    Select Case rstLookup.RecordCount
    Case Is <= 0
    Me!txtSrchResultCount.Value = "No Matches"
    Case Is > 0
    rstLookup.MoveLast
    Me!txtSrchResultCount.Value = rstLookup.RecordCount & " matches."
    Case Else
    End Select
    '*****************************************
    'This is the line item that traps the error...

    Set Me!lstSrchResult.Recordset = rstLookup

    '*****************************************
    Me!lstSrchResult.Requery
    Me!lstSrchResult.BoundColumn = 1
    Me!lstSrchResult.ColumnHeads = True
    Me!lstSrchResult.ColumnCount = 7
    Me!lstSrchResult.ColumnWidths = "0;1 in;.75 in;1 in;1 in;1 in;1 in"
    Me!txtSrchResultSelect.Value = "No Borrower Selected"
    Me!txtSrchResultSelect.FontItalic = True
    Me!txtSrchResultSelect.FontBold = False
    End Sub


    '************************************************* *******
    '************************************************* *******
    '*** This is the error message.
    '***
    '*** Run-time error '-2147467259 (80004005)':
    '***
    '*** Data provider could not be initialized.
    '***
    '************************************************* *******
    '************************************************* *******
    Last edited by Coldendus; 02-24-05 at 20:52.

  2. #2
    Join Date
    Mar 2004
    Posts
    29
    Bump......

  3. #3
    Join Date
    Nov 2003
    Location
    LONDON
    Posts
    238
    Try using the CurrentProject.Connection.ConnectionString property (see Help for what it does and other properties it can help you with) - this will return the correct string every time regardless of whether you are working from home or at work
    Justin

  4. #4
    Join Date
    Mar 2004
    Posts
    29
    I'm afraid that won't work. I'm connecting to an SQL Server back end that will be independant of the project. Also I am creating the recordsets I need because I can manipulate them but for some reason I cannot bind them to the listbox control. I have tried to trap for more connection errors but nothing.

    This has something to do with how the recordset is being bound to the control.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •