How to Check Database's Read-Only Attribute After Database is Open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This may sound strange, but after I open a database, I plan to display
certain fields on a form depending on if the database's read-only attribute
was checked or not. Does anyone know how I check for the the read-only
attribute? I suspect I have to do this using VBA code, which is fine. But I
need to know the code or at least enough to retreive the attributes and check
the read-only attribute.

Thanks in advance.
 
In
Paputxi said:
This may sound strange, but after I open a database, I plan to display
certain fields on a form depending on if the database's read-only
attribute was checked or not. Does anyone know how I check for the
the read-only attribute? I suspect I have to do this using VBA code,
which is fine. But I need to know the code or at least enough to
retreive the attributes and check the read-only attribute.

You can test the read-only attribute of the file using the GetAttr()
function. For example,

If (GetAttr(CurrentDb.Name) And vbReadOnly) <> 0 Then
' The file's read-only attribute is set.
Else
' The file is writeable.
End If
 
Back
Top