1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
Private Sub Label30_Click()
FLASH_cmdButton Me.Name, "Label30", MENU_BACK_REVERSE_COLOR, MENU_BACK_COLOR, 5, True
Dim r As DAO.Recordset
Set r = CurrentDb.OpenRecordset("SELECT * FROM [Bases] where Flag=-1")
Do Until r.EOF
v = Compact(r![nomcompact], r![Chemin base])
r.MoveNext
Loop
End Sub
Public Function Compact(nombase As String, source As String) As Boolean
Compact = False
If Right(source, 1) <> "\" Then ''''retraitement des chemins source et destination
source = source & "\"
End If
Dim nombase1 As String
Dim nombase2 As String
nombase1 = source + nombase + ".mdb"
nombase2 = source + nombase + "temp" + ""
DBEngine.CompactDatabase nombase1, nombase2
Kill nombase1
DoCmd.Rename nombase1, nombase2 'C'est la ou ca bloque!!!!!!
Compact = True
End Function |
Partager