Question : Reliable compress and reindex

I have just had an issue with one of my clients back-end, mdb data files (problem adding records).  It turns out that the autonumber sequence has got out of sync (after a data import).

I have a function that runs the compress and re-index function, via the shell command and the /Compact switch.  However, it didn't fix the issue.  I then opened up the database manually (with MS Access 2003), closed it (initiating the Compress and reindex) - and it worked.

It's not the first time I have seen this and wanted to know the reasons behind it - and if there is a better way?
 
Thanks as always.

Answer : Reliable compress and reindex

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.
Random Solutions  
 
programming4us programming4us