BPL062
Technical User
- Oct 24, 2001
- 20
I want to compact and repair a database after i delete all the records.
All works when i click the first time, but if i click this code a second time it gives me an error
Error message- You attempted to open a database that is already opened exclusively by user 'xxx'
So even though i close everything it still maintains a connection to the database open. I really dont know why
Any help would be appreciated
Here is the code
Public Sub Test()
Dim jro As jro.JetEngine
Set jro = New jro.JetEngine
jro.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & App.Path & "\TemporarioDB.mdb;", _
"Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & App.Path & "\TempDB.mdb;Jet OLEDB:Engine " _
& "Type=5"
Kill App.Path & "\TemporarioDB.mdb"
Name App.Path & "\TempDB.mdb" As App.Path & "\TemporarioDB.mdb"
Set jro = Nothing
End Sub
All works when i click the first time, but if i click this code a second time it gives me an error
Error message- You attempted to open a database that is already opened exclusively by user 'xxx'
So even though i close everything it still maintains a connection to the database open. I really dont know why
Any help would be appreciated
Here is the code
Public Sub Test()
Dim jro As jro.JetEngine
Set jro = New jro.JetEngine
jro.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & App.Path & "\TemporarioDB.mdb;", _
"Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=" & App.Path & "\TempDB.mdb;Jet OLEDB:Engine " _
& "Type=5"
Kill App.Path & "\TemporarioDB.mdb"
Name App.Path & "\TempDB.mdb" As App.Path & "\TemporarioDB.mdb"
Set jro = Nothing
End Sub