Cann't compact database

D

Dou

On the main form, I put a button to compact current database, the code:

CommandBars("Menu Bar"). _
Controls("Tools"). _
Controls("Database utilities"). _
Controls("Compact and repair database..."). _
accDoDefaultAction

I have referenced Microsft Office 11.0 Object Library, it still cann't work.
Why? Thanks
 
V

Van T. Dinh

Not sure but try:

CommandBars("Menu Bar").Controls("Tools").Controls("Database utilities"). _
Controls("Compact and repair database...").Execute

HTH
Van T. Dinh
MVP (Access)
 
S

shirley Lu

Cann't run, Have any other way?
The error message is:

Invalid procedure or Parameter

Thanks
 
V

Van T. Dinh

Have you tried the accDoDefaultAction? This definitely works for A2000,
A2002 but I am not sure about A2003.
 
V

Van T. Dinh

Also, the desperate method is to use SendKeys but this has been out of
flavour since the bug with SendKeys in A97.

--
HTH
Van T. Dinh
MVP (Access)


shirley Lu said:
Cann't run, Have any other way?
The error message is:

Invalid procedure or Parameter

Thanks

Van T. Dinh said:
Not sure but try:

CommandBars("Menu Bar").Controls("Tools").Controls("Database
utilities").
_
Controls("Compact and repair database...").Execute

HTH
Van T. Dinh
MVP (Access)



 

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