create a copy of an existing database as read only

  • Thread starter Thread starter Carlee
  • Start date Start date
C

Carlee

Hello all,

I have a database called AVIS.mdb. Using VBA (on click
event)I want to make a copy of AVIS.mdb and set the
permissions of the new copy to read only. Can anyone help
me?

Many thanks in advance,

Carlee :)
 
Dim strCurrentFile As String
Dim strNewFile As String

strCurrentFile = "C:\My Documents\AVIS.mdb"
strNewFile = "C:\My Documents\Backup\AVIS.mdb"

FileCopy strCurrentFile, strNewFile
SetAttr strNewFile, vbReadOnly

Note that you cannot do this while the database is open.
 
Back
Top