How to build a linked table to SQL Server view?

marks2007

Registered User.
Local time
Today, 09:53
Joined
Nov 12, 2007
Messages
31
Hi,

I want to know how to build a linked table to SQL Server view with DSN - less connection.I can not do this from menus and I hope I can do this with VBA code.

Thanks

Mark
 
Hi WayneRyan,

the code is like this

Set tdf = dbs.TableDefs("tblSomething")
tdf.Connect = "Driver={SQL Server};" & _
"Server=" & Me.txtServerName & ";" & _
"Database=" & Me.txtDatabase & ";" & _
"Trusted_Connection=Yes;" & _
"Table=tblSomething"
tdf.RefreshLink
Set tdf = Nothing

How to change it if I need add user name and password? Thanks

Mark
 

Users who are viewing this thread

Back
Top Bottom