If that's the case, then it would seem that you have either (a) some issues with your databases or (b) troubles with the installation of Access or DAO or Jet. Compact should work regardless of the method you use.
Can you reproduce this on the machine where it happened? That is, using a test database (or a copy of the one where you had issues), can you make this occur again? If so, then I'd suspect the Access/Office/DAO/JET install and have the user repair or reinstall.
I'm not sure what you mean by a "better way". There's only a handful of ways to compact a database, and to me using the Access interface is the best. You can use DAO, ADO, Access automation (in some cases), or Shell to name a few.