PC Review


Reply
Thread Tools Rate Thread

Compacting 2007 database in VBA

 
 
Charles
Guest
Posts: n/a
 
      4th Jul 2009
Hi,

Is there an easy way to compact an Office 2007 Access database using VBA in
Access?

Thanks,
Charles

 
Reply With Quote
 
 
 
 
Tom van Stiphout
Guest
Posts: n/a
 
      4th Jul 2009
On Sat, 4 Jul 2009 13:15:01 -0700, Charles
<(E-Mail Removed)> wrote:

Check the DBEngine.CompactDatabase method in the help file.
Personally I never use this, but use a shortcut or a scheduled task
instead:
<path_to>msaccess.exe <path_to>your.mdb /compact

-Tom.
Microsoft Access MVP


>Hi,
>
>Is there an easy way to compact an Office 2007 Access database using VBA in
>Access?
>
>Thanks,
>Charles
>

 
Reply With Quote
 
Gigamite
Guest
Posts: n/a
 
      4th Jul 2009
Charles wrote:
> Is there an easy way to compact an Office 2007 Access database using VBA in
> Access?


Yes. Compact the current database with one line of code:

SendKeys "%FMC", False
 
Reply With Quote
 
Jack Leach
Guest
Posts: n/a
 
      6th Jul 2009
Does this work when the interface has been removed from a custom app so users
don't have access to all of Access's menu items?

I've never used 2007, but I know in previous versions most people prefer to
remove the standard menu bar and replace it with their own. Being that this
is highly recommended (removing all of the access interface), I assume it is
possible to remove the ribbon or office button or whatever it's called.

So %FMC is for File(?) -> Manage -> Compact, but what if this is removed
from the app and replaced with custom controls instead?

I would think that in A2K3 if I were to try using SendKeys to "automate"
clicking or running a menubar command that was no longer available it would
probably cause some issues.

Just curious...

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)



"Gigamite" wrote:

> Charles wrote:
> > Is there an easy way to compact an Office 2007 Access database using VBA in
> > Access?

>
> Yes. Compact the current database with one line of code:
>
> SendKeys "%FMC", False
>

 
Reply With Quote
 
Gigamite
Guest
Posts: n/a
 
      6th Jul 2009
Jack Leach wrote:
> Does this work when the interface has been removed from a custom app so users
> don't have access to all of Access's menu items?
>
> I've never used 2007, but I know in previous versions most people prefer to
> remove the standard menu bar and replace it with their own. Being that this
> is highly recommended (removing all of the access interface), I assume it is
> possible to remove the ribbon or office button or whatever it's called.


If you're following recommended guidelines for deploying an app, you
don't need this special code. That's because the app is split, the FE
is designed so it doesn't bloat and doesn't need compacting, the BE can
be compacted with the same code that works in A2K3, and if the FE
becomes corrupt and needs repairing, the user can download another copy
to his PC from the server.

 
Reply With Quote
 
Jack Leach
Guest
Posts: n/a
 
      7th Jul 2009

> "Gigamite" wrote:
> If you're following recommended guidelines for deploying an app, you
> don't need this special code. That's because the app is split, the FE
> is designed so it doesn't bloat and doesn't need compacting, the BE can
> be compacted with the same code that works in A2K3, and if the FE
> becomes corrupt and needs repairing, the user can download another copy
> to his PC from the server.


That works.

--
Jack Leach
www.tristatemachine.com

"I haven't failed, I've found ten thousand ways that don't work."
-Thomas Edison (1847-1931)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2007: Escape Out of Compacting Corrupts Database - Database1.zip (0/1) Stewart Berman Microsoft Access Form Coding 17 17th Dec 2009 04:36 AM
Access 2000/2003/2007 crashes while compacting a database דרור Microsoft Access Forms 4 27th Jan 2009 10:43 PM
compacting database Jason Microsoft Access Form Coding 15 22nd Oct 2008 02:18 PM
Compacting Database =?Utf-8?B?dGFzdHllcnM=?= Microsoft Access Form Coding 1 8th May 2006 05:10 AM
Compacting Database -Michelle- Microsoft Access Form Coding 0 3rd Feb 2005 01:13 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:50 AM.