Karen Schaefer
asked on
DSN Less Connection to SQL table in Access
I am trying to connect to an SQL table in Access using DSNLess Connection string for Linked table. Note multiple user will be access this database so setting ups a DSN connection for a linked table will not be sufficient. What am I doing wrong:
Server name = SQL-NWSS-007\AUB1
Database name = FTVI_DBMS
SQL Table Name dbo.TA_AirplaneInfo
Public Function LinkODBCTable()
Dim db As Database, tdf As TableDef
Dim strConnect As String
strConnect = "ODBC;SERVER=MySQLServer;U ID=sa;DRIV ER=SQL" & _
"Server;DATABASE=SQL-NWSS- 007\AUB1\F TVI_DBMS"
Set db = CurrentDb()
Set tdf = db.CreateTableDef(Name:="d bo_TA_Airp laneInfo", Attributes:=dbAttachSavePW D, SourceTableName:="dbo.TA_A irplaneInf o", Connect:=strConnect)
db.TableDefs.Append tdf
End Function
K
Server name = SQL-NWSS-007\AUB1
Database name = FTVI_DBMS
SQL Table Name dbo.TA_AirplaneInfo
Public Function LinkODBCTable()
Dim db As Database, tdf As TableDef
Dim strConnect As String
strConnect = "ODBC;SERVER=MySQLServer;U
"Server;DATABASE=SQL-NWSS-
Set db = CurrentDb()
Set tdf = db.CreateTableDef(Name:="d
db.TableDefs.Append tdf
End Function
K
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I got it, however, how to I make sure the linked table is writable? My current linked table doesnot allow to add new records - WHY?
K
K
If you don't have an index/primary key(s) on the SQL Server tables, the tables, by default, will be read only. And after you do the index/PK, you will have to re-attach the table to get it to be an editable table.
Almost forgot:
Glad to be of assistance. May all your days get brighter and brighter.
Glad to be of assistance. May all your days get brighter and brighter.
ASKER
Karen