quick test if BE is ReadOnly

  • Thread starter Thread starter Gary Walter
  • Start date Start date
G

Gary Walter

Hi,

Having a heck of a time googling this...

Is there some quick code to test
if backend is in readonly state?

Thanks,

gary
 
Gary Walter said:
Hi,

Having a heck of a time googling this...

Is there some quick code to test
if backend is in readonly state?

Thanks,

gary

The trick is to attempt to open the BE exclusively:

Dim db As DAO.Database
On Error Resume Next

Set db = DAO.OpenDatabase("c:\db1.mdb", Options:=True)
If Err.Number > 0 Then
MsgBox "BE is locked"
Else
MsgBox "BE is not in use"
db.Close
End If
Set db = Nothing
 
Thank you Stuart for your trick.

Actually (unless I misunderstand)
I want to know if the backend
file is marked ReadOnly, i.e,
the attribute of the BE file.

At various times in our business cycle,
one backend will briefly be changed
to read-only so users cannot make any
changes to the data. They can connect
okay and read the data -- it is not "locked."

In the front end which can always link to
the tables in backend, there is a process
where I would like to put a quick decision
tree

If fBackEndRO() = True Then

Else

End If

Hope I did not misunderstand...

Thanks,

gary

"Stuart McCall"wrote:
 
sorry... found in Access Help
(<cough>.....I gave up checking there after Acc2K...)

Result = GetAttr(BEFullPath) AND vbReadOnly

(if returns 0, BE not ReadOnly
if returns nonzero value, BE is ReadOnly)
 
Gary Walter said:
Thank you Stuart for your trick.

Actually (unless I misunderstand)

No it was me that misunderstood. Still, you found the correct solution, so
not all is lost.
 
Back
Top