General information
Title:
Compacting an Access DB
I am using the following code to open an access database. I cant seem to close it with the .Close command, so that I can compact it before exiting the program. Any ideas?
Dim WithEvents adoLogRS As Recordset
Form Load
Dim db As Connection
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\DIVERS LOG TABLES.mdb;"
Set adoLogRS = New Recordset
adoLogRS.Open "select * from tblLOG", db, adOpenStatic, adLockOptimistic
Form Unload
adoLogRS.Close
Set adoLogRS = Nothing
db.Close
Set db = Nothing
***then comes the compact db routine, but it always fails, saying, cannot perform operation, database is already open.
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only