Read Only Link

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to make a link from one Access database to a table in another
Access database read only??
 
Not as far as I'm aware using a linked table, but you can create a query
that pulls the data (without needing to link the table) and put the DISTINCT
keyword into the query and it will be read-only:

SELECT DISTINCT Field1, Field2, Field3
FROM [;Database=E:\Folder\File.mdb].Table1

You can then use the query as you would otherwise have used the table.
 
I did post this particular question here and in other forums and finally got
a good response. I did go the query route for a while but I found that very
dissatisfying for various reasons. Below is a much better solution. Note that
you have to set permissions for both Admin & Users. Initially I had set it
just for Users and wound up going with the query solution when that didn't
seem to do anything.

Set newLink = db.CreateTableDef(TableName)
newLink.Connect = ";DATABASE=" & dbPath & "\" & dbName
newLink.SourceTableName = TableName

db.TableDefs.Append newLink

Set con = db.Containers("Tables")
Set doc = con.Documents(NewTableName)

' Mark this link as read-only
doc.UserName = "Admin"
doc.Permissions = dbSecRetrieveData
doc.UserName = "Users"
doc.Permissions = dbSecRetrieveData

--
-Phil-

Douglas J. Steele said:
Not as far as I'm aware using a linked table, but you can create a query
that pulls the data (without needing to link the table) and put the DISTINCT
keyword into the query and it will be read-only:

SELECT DISTINCT Field1, Field2, Field3
FROM [;Database=E:\Folder\File.mdb].Table1

You can then use the query as you would otherwise have used the table.
 
Back
Top