CaroleTSullivan
asked on
Use VBA to link tables in SQL Server
I have an MSAccess database that links tables to a SQL Server database via ODBC. I would like to dynamically link those tables when the database is opened to avoid having the user needing the ODBC entry on their PC. I can establish the link to the SQL Server database but from there, how do I LINK the tables.
This is how I establish the connection to the sql server database. Can I use VBA code to link to the tables I need from here?
strsql = "Driver={SQL server}; Server=" & g_dbserver & "; Port=1433; Option=0; Socket=; Stmt=; Database=" & g_db & "; Uid=" & g_dbuserid & "; Pwd=" & g_dbpassword & "; Network=DBMSSOCN;"
OBJdbConnection.Open strsql
objCommand.ActiveConnectio n = OBJdbConnection
OBJdbConnection.CommandTim eout = 0
objCommand.CommandTimeout = 0
This is how I establish the connection to the sql server database. Can I use VBA code to link to the tables I need from here?
strsql = "Driver={SQL server}; Server=" & g_dbserver & "; Port=1433; Option=0; Socket=; Stmt=; Database=" & g_db & "; Uid=" & g_dbuserid & "; Pwd=" & g_dbpassword & "; Network=DBMSSOCN;"
OBJdbConnection.Open strsql
objCommand.ActiveConnectio
OBJdbConnection.CommandTim
objCommand.CommandTimeout = 0
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.