Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'Created: 17-July-2007
'Version: 2.0.2
'Purpose: Changes the ODBC connection string for all SQL Server linked tables
Public Sub ChangeSQLConnection(NewConnection As String)
Dim dbs As DAO.Database
Dim tdf As TableDef
Set dbs = CurrentDb
For Each tdf In dbs.TableDefs
'Only change tables linked to SQL server
If Left(tdf.SourceTableName, 4) = "dbo." And Left(tdf.Name, 4) <> "MSys" And _
tdf.Connect <> "" Then
tdf.Connect = NewConnection
tdf.RefreshLink
End If
Next
Set tdf = Nothing
Set dbs = Nothing
MsgBox "Finished Relinking!", vbInformation, "Finished"
End Sub
Provider=SQLNCLI;Server=MyServerName;Database=MyDBName;Uid=SomeLogin;Pwd=TheSecretPassword;
Public Function GetSQL2005ConnString() As String
'Version: 2.0.0
'Date Created: 27-Jun-2007
'Purpose: Builds the ADO connection string to the SQL 2005 database by
' parsing the ODBC connection of one of the linked tables
Dim odbcConn As String
Dim server As String
Dim uid As String
Dim pswd As String
Dim db As String
Dim start As Integer
Dim endAt As Integer
odbcConn = CurrentDb.TableDefs("Employees").Connect
start = InStr(1, odbcConn, "SERVER=") + 7
endAt = InStr(start, odbcConn, ";")
server = Mid(odbcConn, start, endAt - start)
start = InStr(1, odbcConn, "DATABASE=") + 9
db = Mid(odbcConn, start)
start = InStr(1, odbcConn, "UID=") + 4
endAt = InStr(start, odbcConn, ";")
uid = Mid(odbcConn, start, endAt - start)
start = InStr(1, odbcConn, "PWD=") + 4
endAt = InStr(start, odbcConn, ";")
pswd = Mid(odbcConn, start, endAt - start)
GetSQL2005ConnString = "Provider=SQLNCLI;Server=" & server & _
";Database=" & db & ";Uid=" & uid & ";Pwd=" & pswd & ";"
End Function
That's where I get the idea that she wants to change how Access links to the tables. But her post is rather vague and requires elaboration.Nancy2 said:the users need to see the linked tables - like they do with the ODBC connection