Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Posts
    55

    Unanswered: DataGrid ConnectionString

    I'm trying to display all of the records in a Access table using a dataGrid object. It seemed straight forward, but I have run into a problem. I keep getting a message "[Microsoft][ODBC Diver Manager] Data source name not found and no defualt driver specified". Can anyone help.

    Here is my code:

    Private Sub cmdViewPanels_Click()
    Dim clsImp As Import
    Dim strIOSTbl As String
    Dim rstADO As ADODB.Recordset


    Set connTo = New ADODB.Connection
    Set clsImp = New dbConnection
    Set rstADO = New ADODB.Recordset

    Set connTo = clsImp.setConnection("\\Esi-sum-program\c-17 edl\Databases\SSC ICD\SSC_ICD.mdb")

    connTo.CursorLocation = adUseClient
    rstADO.Open "SELECT * FROM [COMBINED SSC_ICD]", connTo, adOpenDynamic, adLockOptimistic, adCmdText

    *******Set frmDBGrid.DGrid.DataSource = rstADO this is where I get my error*******

    frmDBGrid.Caption = "COMBINED SSC_ICD"
    frmDBGrid.DGrid.Caption = "COMBINED SSC_ICD"
    frmDBGrid.DGControl.Caption = "COMBINED SSC_ICD"
    frmDBGrid.Visible = True
    frmDBGrid.DGrid.Visible = True
    frmDBGrid.DGControl.Visible = True

    clsImp.closeConnection connTo
    End Sub

    Thanks,

    Animaul

  2. #2
    Join Date
    Feb 2004
    Posts
    199
    there is no enough parameters in your connection string, I can't remember that and if you can't find it by yourself in help, I'll try to remember and post later.
    MDB, ADP <-> MS SQL + VBA, ADO & RDO, .NET, Oracle, Java/Jsp.

  3. #3
    Join Date
    Nov 2003
    Posts
    55
    Here is my connection method:

    Private Function Import_setConnection(ByVal strDbPath As String) As ADODB.Connection
    'Declaring variables
    Dim strDBN As String
    Dim conn As ADODB.Connection

    'initializing variables
    strDBN = strDbPath

    'On Error GoTo ErrorHandler
    'Opening connection to database
    Set conn = New ADODB.Connection

    With conn
    .CommandTimeout = 45
    .ConnectionTimeout = 25
    .IsolationLevel = adXactCursorStability
    .CursorLocation = adUseServer
    .Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & strDBN & ";" & _
    "Jet OLEDBystem Database=J:\Mdw\ESIC17.mdw", "Admin", "12345"
    End With
    Debug.Print "connected"

    Set Import_setConnection = conn
    Exit Function

    ErrorHandler: 'in the event of an error adding records branch here
    DoCmd.SetWarnings True
    Set conn = Nothing
    Import_setConnection = conn
    End Function

    I have tried using a connection string like the one here but it does not work. However that type of connecting string works when setting it up throught the ADO controls connection string property.

    Originally posted by Kakha
    there is no enough parameters in your connection string, I can't remember that and if you can't find it by yourself in help, I'll try to remember and post later.

Posting Permissions

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