| General |
| 6.190 Compattatore MDB esterno tramite Command(/cmd) |
| Alessandro Baraldi |
|
Sfrutta il passaggio del parametro Command che viene letto all'apertura dell'applicativo tramite l'esecuzione della Macro AUTOEXEC ----> =Compatta() Per utilizzarlo mettere la seguente funzione nel proprio applicativo e richiamarla così: Riapre l'applicativo chiamante dopo il COMPACT
Call DoCompact ("C:\Programmi\DB_Compact.mdb",True)
Non riapre l'applicativo chiamante dopo il COMPACT
Call DoCompact ("C:\Programmi\DB_Compact.mdb",false)
Public Function DoCompact(PathCompact as string, ReStart As Boolean)
Dim strCompacter As String
Dim strExePath As String
strExePath = SysCmd(acSysCmdAccessDir) & "msAccess.Exe"
strCompacter = Chr$(34) & PathCompact & Chr$(34) _
& " /cmd" & " " & CurrentDb.Name
If ReStart = True Then
strCompacter = strCompacter & ";True"
Else
strCompacter = strCompacter & ";False"
End If
Call Shell(strExePath & " " & strCompacter, vbNormalFocus)
End Function
Download: |