Jim Dettman
jimdettman at verizon.net
Sun Apr 13 17:12:44 CDT 2014
Well you've never been able to compact an open DB, and that rule still applies. The trick here is that because it's MSACCESS.EXE that is doing the C&R rather than VBA, the DB can be closed, C&R run, and then re-opened. That's what's going on when you choose it from the file menu. But when doing it from code, you can't close the DB because VBA code is currently executing. Also note that a compact and repair from DAO is not the same either as it doesn't take into account Access objects, but simply data. JET doesn't know about Access objects. Jim. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bill Benson Sent: Saturday, April 12, 2014 07: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