Compressing/Repairing Programmatically

C

Chaplain Doug

How would I initiate a database compress/repair from VBA
code? I know that this might be like a cat eating its own
tail, but I thought I would ask.
 
G

Gottfried Lesigang

Hi!
How would I initiate a database compress/repair from VBA
code? I know that this might be like a cat eating its own
tail, but I thought I would ask.As far as I know there's no way to
compress and repair a DB from within...

You could try to put this command in a second *.mdb and tricks around with a
second Access-instance using "CloseCurrentDb" and "OpenCurrentDb". But there
is a good chance that this will not work...

Maybe you could code a compiled EXE-Application which you call from inside,
which kills your Access-instance, does the comression and repairing and
opens it again.

Anyway this is very ugly and not very satisfying...

If you find out a good way - please post it here!

HTH, Gottfried
 
K

Ken Snell

You can't compact/repair the database that is currently open. But you can do
it from another database.

Send an email to me (remove this is not real from my return address) and
I'll email an example database to you that I use via Windows Scheduler to
compact a database.
 

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