Sub COMPACT()
Dim JRO As JRO.JetEngine
Dim strSource As String
Dim strDest As String
On Error GoTo errore
Set JRO = New JRO.JetEngine
If Len(Dir$("C:\APPLICAZIONI\xxxx.ldb")) > 0 Then
GoTo FINE
Else
strSource = "C:\APPLICAZIONI\xxxx.mdb"
strDest = "C:\APPLICAZIONI\xxxx_BK.mdb"
JRO.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data" & _
" Source=C:\APPLICAZIONI\xxxxx.mdb", "Provider=Microsoft.Jet.OLEDB.4.0;Data" & _
" Source=C:\APPLICAZIONI\L0928_BK.mdb;Jet OLEDB:Engine Type=5"
TEST_JRO = "OK"
Kill strSource
Name strDest As strSource
FINE:
Set JRO = Nothing
End If
Exit Sub
errore:
MsgBox "Errore Numero: " & CStr(Err.Number) & vbCrLf & "Descrizione: " & Err.Description & _
vbCrLf & "Sorgente dell'Errore: " & Err.Source
Err.Clear
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub