Dan Waters
df.waters at comcast.net
Sun Apr 13 10:18:20 CDT 2014
Hi Bill, You're right - you cannot compact the database where the code resides. What the code does allow you to do is compact a different database file, once you set a reference to it and set it as the current database. I create utility files to do this so I can compact an Access file with a single click on a shortcut. As an aside: In my systems, I set the back end file (all the tables) to Compact on Close. When the last person closes their front end file on their PC, the BE file will close and compact. So it gets compacted at least once per day. And I've had no data corruption for many years that couldn't be attributed to some external event. Thanks! Dan -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Saturday, April 12, 2014 6:11 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] compacting from code - improper error message instructions DoCmd.RunCommand acCmdCompactDatabase fails for predictable reasons but interesting how even the Access development team did not keep up with their own interface changes, writing in the 2010 environment, as this function is in the Database Tools menu. You cannot compact the open database by running a macro or Visual Basic code. Instead of using a macro or code, click the File tab and then click Compact and Repair database. Seems like the development team at Access doesn't even support themselves, let alone the user community. Maybe if I wasn't ticked that I couldn't compact from code, which I personally think we ought to be able to do, I would have let this slide. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com