Compacting 2007 database in VBA

C

Charles

Hi,

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

Thanks,
Charles
 
T

Tom van Stiphout

On Sat, 4 Jul 2009 13:15:01 -0700, Charles

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
 
G

Gigamite

Charles said:
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
 
J

Jack Leach

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)
 
G

Gigamite

Jack said:
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.
 
J

Jack Leach

:
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top