quick test if BE is ReadOnly

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
 
S

Stuart McCall

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
 
G

Gary Walter

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:
 
G

Gary Walter

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)
 
S

Stuart McCall

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.
 

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