Chuck Wood
asked on
How To Create a Link to a SQL Server 2012 Table from Access 2010?
How do I manually create a link in Access 2010 to a SQL Server 2012 database table using the following connection String?
ODBC;
DRIVER=SQL Server;SERVER=MySqlServer;
Trusted_Connection=Yes;
APP=SSMA;
DATABASE=MyDb;
TABLE=GL_MyTable;
ODBC;
DRIVER=SQL Server;SERVER=MySqlServer;
Trusted_Connection=Yes;
APP=SSMA;
DATABASE=MyDb;
TABLE=GL_MyTable;
ASKER
Yes.
Which one ... using code or from Access database window???
Et
Et
ASKER
Using the Access database window.
In VBA Code ... I use a 1 record table called SetupGeneral to store various parameters like SQL Login information. Then use the DLookup function in code to get parameters when needed as shown below.
ET
Dim strSQLServerHost As String
Dim strSQLDatabase As String
Dim strSQLLogin As String
Dim strSQLPswd As String
Dim strSQLConn As String
strSQLServerHost = DLookup("[SQL_SERVERHOST]", "SetupGeneral")
strSQLDatabase = DLookup("[SQL_DATABASE]", "SetupGeneral)
strSQLLogin = DLookup("[SQL_LOGIN]", "SetupGeneral)
strSQLPswd = DLookup("[SQL_PSWD]", "SetupGeneral)
'Build the SQL Server Connection String
strSQLConn = "ODBC;Driver={SQL Server};Server=" & strSQLServerHost & ";Database=" & strSQLDatabase & ";Uid=" & strSQLLogin & ";Pwd=" & strSQLPswd & ";"
ET
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That worked. Thank you.
ET