MasterRacker
New member
I am building an application for reporting and ad-hoc querying that links to the JET backend of a COTS application. I want to prevent any possibility of accidentally modifying any data and connect tables read-only.
From what I can find, the .Attributes method can't be modified and I can't seem to find any info on a read-only connect string. Can I do this?
Jeff
[small][purple]It's never too early to begin preparing for [/purple]International Talk Like a Pirate Day
"The software I buy sucks, The software I write sucks. It's time to give up and have a beer..." - Me[/small]
From what I can find, the .Attributes method can't be modified and I can't seem to find any info on a read-only connect string. Can I do this?
Code:
Public Function LinkTable(dbFQN As String, tbName As String)
On Error GoTo Err_None
Dim result As Integer
Dim db As DAO.Database
Dim td As DAO.TableDef
result = SysCmd(SYSCMD_SETSTATUS, "Linking Table: " & tbName)
Set db = CurrentDb()
db.TableDefs.Delete tbName ' Remove Existing Table (maybe check first?)
On Error GoTo Err_Handler
Set td = db.CreateTableDef(tbName)
td.Connect = ";DATABASE=" & dbFQN
td.SourceTableName = tbName
db.TableDefs.Append td ' create table link
LinkTable = 0
Exit_Here:
Exit Function
Err_None:
If Err = 3265 Then Resume Next ' table not found
Err_Handler:
If Err = 3011 Then ' Can't find table
Application.Echo True
MsgBox "Table " & tbName & " not found in " & dbFQN
ElseIf (Err <> 3044) And (Err <> 3024) Then '3044 = invalid path, 3024 = can't find DB
Application.Echo True
MsgBox "LinkTable: " & Error$(Err)
End If
LinkTable = Err
Resume Exit_Here
End Function
Jeff
[small][purple]It's never too early to begin preparing for [/purple]International Talk Like a Pirate Day
"The software I buy sucks, The software I write sucks. It's time to give up and have a beer..." - Me[/small]