I am trying to close a database and delete the mdb file. However, when I do this, it does not delete the file because the file is still locked. I get a runtime error '70' Permission Denied. Using DAO 3.6, is there a way to check to see if the mdb is still locked and wait until it is ok to delete it or is there a better way to do this?
If Not (Dbs Is Nothing) Then
Set Dbs = Nothing
sFileSpec = ProjectPath & "\" & ProjectName & ".mdb"
If Dir(sFileSpec) <> vbNullString Then Kill sFileSpec