[AccessD] Knowing when DB is read-only

A.D.Tejpal adtp at touchtelindia.net
Tue Feb 15 12:39:04 CST 2005


Erwin,

    You should be able to get the status via file system object.  Suitable user defined function is given below. Reference to Microsoft Scripting RunTime is needed.

    Following expression will get the status for the current db.
        Fn_GetDbStatus(CurrentProject.FullName)

With best wishes,
A.D.Tejpal
--------------

================================
Function Fn_GetDbStatus(ByVal Fpt _
                                    As String) As String
    Dim fso As FileSystemObject, fe As File
    Dim Dbs As Long, Sts As String
    
    Sts = "Other"      ' Default Value
    
    Set fso = New FileSystemObject
    Set fe = fso.GetFile(Fpt)
    Dbs = fe.Attributes
    Select Case Dbs
        Case 1
            Sts = "ReadOnly"
        Case 2
            Sts = "Hidden"
        Case 32
            Sts = "Archive"
    End Select
    
    Fn_GetDbStatus = Sts

    Set fso = Nothing
    Set fe = Nothing
End Function
================================

  ----- Original Message ----- 
  From: Erwin Craps - IT Helps 
  To: Access Developers discussion and problem solving 
  Sent: Tuesday, February 15, 2005 15:59
  Subject: [AccessD] Knowing when DB is read-only


  Dear group
   
  I have a backend MDB database that is about 677MB in size and
  growing....
  For reasons of fast recovery this file is not only backuped on tape
  several times a day, but also copied several times a day to my notebook
  computer (using briefcase but I don't use syncing at datalevel, just
  file level).
   
  Because copying this file takes about a minute or so, it seems that the
  database get's in a read-only state.
  I noticed this because on my server two applications run every 2,5
  minutes dooing some stuff on it, but during the filecopy I get "No
  updateable query" errrors.
   
  So the question is, how can I get the state of the database during
  opening so I can leave straightaway the application on the server when
  it notices that the backend is read-only or whatever state while copying
  the file to my notebook???
   
  Greetz 

  Erwin Craps
  Zaakvoerder 




More information about the AccessD mailing list