Hi, paste this into the declarations section of a new or existing module:
Declare Function SetFileAttributes Lib "kernel32.dll" Alias "SetFileAttributesA" (ByVal lpFileName As String, ByVal dwFileAttributes As Long) As Long
Public Const FILE_ATTRIBUTES_ARCHIVE = &H20
Public Const FILE_ATTRIBUTES_HIDDEN = &H2
Public Const FILE_ATTRIBUTES_NORMAL = &H80
Public Const FILE_ATTRIBUTES_READONLY = &H1
Public Const FILE_ATTRIBUTES_SYSTEM = &H4
To make a File Read Only, paste this behind a Button on a Form:
Dim lngAttributes As Long, strFile As String
strFile = "c:\my documents\Test.mdb"
lngAttributes = FILE_ATTRIBUTES_ARCHIVE Or FILE_ATTRIBUTES_READONLY
Call SetFileAttributes(strFile, lngAttributes)
To make a File Normal, paste this behind a Button on a Form:
Dim lngAttributes As Long, strFile As String
strFile = "c:\my documents\Test.mdb"
lngAttributes = FILE_ATTRIBUTES_ARCHIVE Or FILE_ATTRIBUTES_NORMAL
Call SetFileAttributes(strFile, lngAttributes)
Bill