[AccessD] compacting from code - improper error message instructions

Bill Benson bensonforums at gmail.com
Sun Apr 13 10:45:44 CDT 2014


Yes Dan,  a best practice from all that I have read ...

I was sorta tongue in cheek declaring it to be a defect not being able to
compact in code.

Actually I "can" (but should not), with Sendkeys, as long as the interface
is active. Either one line of code if you want to take a chance that the
ribbon menus are all where they ought to be, and no customizations have
interfered with the accelerator keys.

But also you could loop through all the commands on the ribbon, test their
captions, and make SURE you tab as many or few to the right of FILE and
thereafter use the correct command keys as many times as justified by the
appearance order of the relevant accelerator key (s).

All this depends upon MS not taking away Alt Key menu invocation.

Thanks for the reply!
On Apr 13, 2014 11:19 AM, "Dan Waters" <df.waters at comcast.net> wrote:

> 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
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list