All
I have next code in my MS Access 2010 to make a connection to a SQL-table. The code starts with the function Startup() and creates an ODBC-connection to a table "mytable" on an SQL-server.
All of below works, but there is one problem. I only have one account which has full control on the table. For current project, I need to open the ODBC-connection as a read-only. I can't change the security rights on the server and I neither can create an extra view with a "select distinct * from..."
So is there some option to put something in code below so the table is opened as read-only?
Regards
Ino
I have next code in my MS Access 2010 to make a connection to a SQL-table. The code starts with the function Startup() and creates an ODBC-connection to a table "mytable" on an SQL-server.
All of below works, but there is one problem. I only have one account which has full control on the table. For current project, I need to open the ODBC-connection as a read-only. I can't change the security rights on the server and I neither can create an extra view with a "select distinct * from..."
So is there some option to put something in code below so the table is opened as read-only?
Code:
public function Startup()
CreateODBCLink "mytable"
end function
public sub CreateODBCLink(x as string)
Dim db As DAO.Database
Dim td As DAO.TableDef
Set db = CurrentDb
On Error Resume Next
Set td = db.TableDefs(x)
If Err.Number <> 0 Then
Set td = db.CreateTableDef(x)
td.Connect = "ODBC;Driver={SQL Server};Server=[I]server[/I];Database[I]=database[/I][I];[/I]UID=[I]username[/I];PWD=[I]password[/I];"
td.SourceTableName = strSchema & x
db.TableDefs.Append td
Else
db.TableDefs.Refresh
End If
Regards
Ino