Compact and Repair the current database automatically in VBA in Access 2010?

For MS Access 2010, the only way I have found to compact a database via a button is by executing the following code:-

SendKeys “%F{TAB}{TAB}{ENTER}”