'Used with setting the status bar message
Public vStatusBar As Variant
Public Function CompactOnClose()
On Error GoTo Err_CompactOnClose
If FileLen(CurrentDb.Name) > 5000000 And CurrentUser <> "programmer" Then '> 5 megabytes
Application.SetOption ("Auto Compact"), 1
Application.SetOption "Show Status Bar", True
vStatusBar = SysCmd(acSysCmdSetStatus, "The application must be compacted, please do not interfere with the Compacting process!")
Else
Application.SetOption ("Auto Compact"), 0
End If
Exit_CompactOnClose:
Exit Function
Err_CompactOnClose:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_CompactOnClose
End Function