Hi Norbert,
you can't be linked to any tables when you change the ReadOnly flag
'~~~
dim sPathFile as string
sPathFile = "c:\path\dbfilename.accdb"
'set ReadOnly
Call SetAttr(PathName:=sPathFile, Attributes:=vbReadOnly)
'set Normal
Call SetAttr(PathName:=sPathFile, Attributes:=vbNormal)'~~~
dim sSQL as string _
, sPathFile as string
sPathFile = "c:\path\dbfilename.accdb"
Dim db As DAO.Database _
, tdf As DAO.TableDef
, tdf As DAO.TableDef
Set db = CurrentDb
'delete link to table from the currentdb
sSQL = "drop table " & sTablename
db.execute sSQL
'link to the table
With db
Set tdf = .CreateTableDef(sTablename)
tdf.Connect = ";Database=" & sPathFile
tdf.SourceTableName = sTablename
.TableDefs.Append tdf
With db
Set tdf = .CreateTableDef(sTablename)
tdf.Connect = ";Database=" & sPathFile
tdf.SourceTableName = sTablename
.TableDefs.Append tdf
end with
Set tdf = Nothing
Set db = Nothing
Set db = Nothing
'~~~
Warm Regards,
Crystal
~ have an awesome day ~
On Sunday, December 21, 2014 6:43 AM, "drnorbert@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:
I am splitting Access 2013 (has SQL as a backend) into an Active database and Archive database.
The Archive should be place in Read Only with an option to be able to change it back to edit.
How do I implement this objective via VBA?
Thanks
Norbert
__._,_.___
Posted by: Crystal <strive4peace2008@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar