You can do that using the command line parameters of MSACCESS.exe. Create a batch file and schedule it as a task passing the MDB as a parameter to it. Batch file should contain code similar to the one given below.
Code:
REM --- Backup the file before compact.
"C:\Program Files\Microsoft Office\Office\msaccess.exe" %1 /compact /repair
Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection