joesmow
asked on
Close mdb database and delete it
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. Using DAO, 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
Dbs.Close
Set Dbs = Nothing
Data1.Database.Close
Data2.Database.Close
DoEvents
End If
sFileSpec = ProjectPath & "\" & ProjectName & ".mdb"
If Dir(sFileSpec) <> vbNullString Then Kill sFileSpec
If Not (Dbs Is Nothing) Then
Dbs.Close
Set Dbs = Nothing
Data1.Database.Close
Data2.Database.Close
DoEvents
End If
sFileSpec = ProjectPath & "\" & ProjectName & ".mdb"
If Dir(sFileSpec) <> vbNullString Then Kill sFileSpec
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER