create a copy of an existing database as read only

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 :)
 
D

Douglas J. Steele

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top