• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

Unable to connect sql to ms access....

Hi Experts
(this is a follow up question to: http://www.experts-exchange.com/Microsoft/Development/MS_Access/Q_28232414.html)

And once again sorry/apologies if this is not the correct method of posting questions on the EE board. Sorry!!! if i have borken any rules.

I am having a nightmare trying to establish a connection to ms access via sql on a odbcad32.exc...

i have tried using the following vba to change the connection string and no luck for two days...

Public Function GetQueryLinks()
On Error GoTo Err_GetQueryLinks

    'Dim StrConn As ADODB.Connection
    'Set StrConn = New ADODB.Connection
    Dim qdf As DAO.QueryDef
    Dim StrConn As String
     StrConn = "ODBC;Driver=(Apples_Oranges);SERVER=SQAAPB3SBCA65130.global.Hire.com;Database=Apples_Oranges);;Port=12351;"
     For Each qdf In CurrentDb.QueryDefs
        If qdf.Connect <> "" Then

            qdf.Connect = StrConn
            Debug.Print qdf.Connect

        End If

    Set qdf = Nothing
    Exit Function

    MsgBox Err.Number & " (" & Err.Description & ") in procedure GetQueryLinks of Module basTableLinks"
    Resume Exit_GetQueryLinks

End Function

Open in new window

  • 3
  • 2
1 Solution
route217Author Commented:
thanks for the feedback..

what about the other way around access to sql..
route217Author Commented:
hi expert...
thanks for the feedback but this is connecting sql to access...whats the reverse cod2...

I am  new to this...how do u connect access to sql...my initial vba is attached. .
My second message gives links about how to connect to SQL server, from any application, Access included.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now