Information générale
Titre:
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.
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement