Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2003
    Posts
    20

    Unanswered: Problem With Link to a DSN db using ADO

    Hi All,

    Newbie back with another problem. We are trying to link to a DSN database from an Access db but having great difficulty. Have tried numerous suggestions from various boards, but having little success. Below is the code we are using. I have also noted the error we are experiencing. We know the spelling of the DSN location and path are correct as other connections in another database use this DSN and all is well there (we do not do a link with that DB). The need to get this done is quite urgent, so any help or suggestions would be most sincerely appreciated.

    Public Function Link_ADO_DSN(strTable As String)
    Dim strODBC_DSN As String
    Dim strODBC_TableName As String
    Dim strODBC_UserID As String
    Dim strODBC_Password As String

    Set cat = New ADOX.Catalog
    Set tbl = New ADOX.Table

    strODBC_DSN = "MyDSN"
    strODBC_TableName = strTable
    strODBC_UserID = "UserA"
    strODBC_Password = "12345"

    '*** Set the ADO connection
    cat.ActiveConnection = CurrentProject.Connection

    '*** Set the name and target for the table
    tbl.Name = strODBC_TableName
    Set tbl.ParentCatalog = cat

    '*** Set the properties for the linked table
    tbl.Properties("Jet OLEDB:Create Link") = True
    tbl.Properties("Jet OLEDB:Link Provider String") = _
    "ODBC;DSN=" & strODBC_DSN & ";" & _
    "UID=" & strODBC_UserID & ";pwd=" & strODBC_Password & ";"
    tbl.Properties("Jet OLEDB:Cache Link Name/Password") = True
    tbl.Properties("Jet OLEDB:Remote Table Name") = strODBC_TableName

    '*** Append the table to the collection
    cat.Tables.Append tble <==== ERROR HERE ====>

    Set tbl = Nothing
    Set cat = Nothing

    End Function


    Error message:

    Run-time error '-2147217860 (80040e3c)':
    The Microsoft Jet database engine could not find the object."
    Make sure the object exists and that you spell its name and
    the path name correctly.

  2. #2
    Join Date
    Jan 2005
    Posts
    18
    try this yaar

    tbl.Properties("Jet OLEDB:Link Provider String") = _
    "Microsoft.Jet.OLEDB.4.0;DSN=" & strODBC_DSN & ";" & _

  3. #3
    Join Date
    Jan 2005
    Posts
    18
    try this yaar

    tbl.Properties("Jet OLEDB:Link Provider String") = _
    "Microsoft.Jet.OLEDB.4.0;DSN=" & strODBC_DSN & ";" & _

  4. #4
    Join Date
    Jul 2003
    Posts
    20

    Problem With Link to a DSN db using ADO

    neezha_s

    Thank you so much for your reply. Sorry for the delay in responding, was out of the office yesterday. I changed the line as you suggested and now I get an error message:

    Cannot find an installable ISAM

    Being new, I don't really know what to do next. Any thoughts?

    Thanks again for your help.

    REFIN

Posting Permissions

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