Sure, you could just write another MDB thats only purpose is to compact the other.
Just write the code necessary to compact the external database, then include a macro named "Autoexec" which executes that code. The compacting code should also exit the entire "mini-database" when it has completed compacting. The "Autoexec" macro, if you haven't come across it already, is a special macro which will execute on the opening of the database. This of course follows along the lines of Autoexec.bat.
After you've set that up, just make sure to include the opening of that database at the close of your main one(put the opening statement after all of the code that runs the delete queries). This way, the database closes and the code you need run to compact the database is run in an entirely seperate file. I hope that I've explained this in a way that is able to be understood. If you have any questions or need any other help, drop me an e-mail and I'll see what I can do. Good luck! =]