MS Access: how to compact current database in VBA

后端 未结 13 1642
慢半拍i
慢半拍i 2020-11-29 07:34

Pretty simple question, I know.

13条回答
  •  甜味超标
    2020-11-29 07:58

    Yes it is simple to do.

    Sub CompactRepair()
      Dim control As Office.CommandBarControl
      Set control = CommandBars.FindControl( Id:=2071 )
      control.accDoDefaultAction
    End Sub
    

    Basically it just finds the "Compact and repair" menuitem and clicks it, programatically.

提交回复
热议问题