"Compact and Repair Database" Command in a Form

  • Thread starter Thread starter Michael
  • Start date Start date
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
 
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
 
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.
 
Back
Top