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;
LVL 16
Chuck WoodAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Eric ShermanAccountant/DeveloperCommented:
Manually using VBA Code or do you mean manually using the Access database window???

ET
Chuck WoodAuthor Commented:
Yes.
Eric ShermanAccountant/DeveloperCommented:
Which one ... using code or from Access database window???

Et
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Chuck WoodAuthor Commented:
Using the Access database window.
Eric ShermanAccountant/DeveloperCommented:
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.

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 & ";"

Open in new window


ET
Eric ShermanAccountant/DeveloperCommented:
>>>>Using the Access database window. <<<<

1.) Create a DSN (Data Source Name) using your SQL ODBC driver installed on your machine.
2.) Select the External Data tab from the Access Menu/Ribbon.
3.) Select ODBC Database.
4.) Select Lint to the data source.

Then just follow the prompts.  

ET

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Chuck WoodAuthor Commented:
That worked. Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.