"Compact and Repair Database" Command in a Form

M

Michael

I would like to run the "Compact and Repair Database"
command by clicking a command button on a form.

The "DoCmd.RunCommand acCmdCompactDatabase" cannot work
while running a VB code or macro. Also, I can't find the
right parameters to use with "DoCmd.DoMenuItem" for that
command.

I already created a custom toolbar with this command. But
this is the top menu. I would like to have it also in the
main menu, which is a form.

Can it be done?

Thanks,

Michael
 
G

Guest

I use this code to compact the current database over itself..
CommandBars("Menu Bar").
Controls("Tools").
Controls("Database utilities").
Controls("Compact and repair database...").
accDoDefaultActio
 
C

Chuck L

This seems to be the answer to a question that I had asked
on a separate part of this site, however, when I tried to
use it, I get an error. I am not familiar with writing
code (but learning). I have used the help feature to get
started. I am writing this code in a module.? I do not
know how to begin. Is this a sub procedure? If so, I am
assuming that I would start it... Sub [?] and then paste
what is below in the procedures area of the module? I'm
pulling my hair out trying to figure this out. Any help
would be greatly appreciated. Thanks.
 

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