route217
asked on
querydef function not working???
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....
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No, it was just for inspiration.
/gustav
/gustav
ASKER
apples_oranges
is a made u0 name of the database
is a made u0 name of the database
ASKER
still getting odb cconnection failed error message
ASKER
thanks fot it working
Then check the existing connect string of an attached table or one of the queries and adjust your new connection as needed.
/gustav
/gustav
ASKER
sould I add ur vbq to a new sub