troubleshooting Question

querydef function not working???

Avatar of route217
route217Flag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft Access
7 Comments1 Solution532 ViewsLast Modified:
Hi Experts (access 2003)
Shot in the dark....

I have the following function to set my SQL connection strings to the following instant...is the code incomplete or do i need to tell it (vba code0 that it's a new connection....totally confused...

If i am talking rubbish please step in.....and correct me...

I am trying to connect to SQL and keep on getting a ODBC connection failure error msg...

whats could be wrong....

Public Function GetQueryLinks()
On Error GoTo Err_GetQueryLinks

    Dim qdf As DAO.QueryDef
    Dim StrConn As String
    
    StrConn = "ODBC;Driver=SQL Server;UID=MyUID;PWD=MyPass;Server=SEEEPB4SBT45646.global.Hire.com;Port=43533;Database= Apples_Ornages;"
         
     For Each qdf In CurrentDb.QueryDefs
        If qdf.Connect <> "" Then

            qdf.Connect = StrConn
            Debug.Print qdf.Connect

        End If

        Next
            
Exit_GetQueryLinks:
    Set qdf = Nothing
    Exit Function

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

End Function
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 7 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros