Firstly thanks to all the excellent feedback given so far...
I am open a second part to a pervious question: Which expert Jim has given invaluble feedback on
See reply back ID:39467816 (the question i accepted with points)
Based on the experts feed back i am stuck on the following;
Rather then saying if it has a connect string, then replace it, you need to be a bit more selective.
Use InStr() to search the connect string, say a server name.
Once you know this is a string you want to change, you have two choices: (point 2 look wasy option?)
1. Rebuild the string from scratch
2. Replace each of the parts (like the server name) using InStr(), Left(), Mid(), etc.
Code I have so far:-
Option Compare Database
Public Function GetQueryLinks()
On Error GoTo Err_GetQueryLinks
Dim qdf As DAO.QueryDef
Dim strConn As String
strConn = "ODBC;Driver=(Apple_Oranges);UID=MyUID;PWD=MyPass;SERVER=TheServer;"
For Each qdf In CurrentDb.QueryDefs
If qdf.Connect <> "" Then
qdf.Connect = strConn
Set qdf = Nothing
MsgBox Err.Number & " (" & Err.Description & ") in procedure GetQueryLinks of Module basTableLinks"