设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 4536|回复: 5
打印 上一主题 下一主题

[与其它组件] 如何压缩正在使用的数据库

[复制链接]

点击这里给我发消息

1#
发表于 2004-6-11 20:26:00 | 显示全部楼层
站长的函数

Function Compact()

  With CommandBars.Add(, msoBarFloating, , True)

   Const CompactId As Long = 2071



   .Controls.Add msoControlButton, CommandBars("Tools").Controls(7).CommandBar.Controls(2).Id

   DoEvents

   .Visible = True

   .Controls(1).SetFocus

   SendKeys "{ENTER}" '模拟击键压缩

  End With

End Function





李啸林 修改,可以适合97与XP,我没有安装过ACCESS 2000,希望你们能给我补上。



Dim ref As Reference

Dim i As Byte



Set ref = References!Access



'我不用Application.Vertion是由于,这个属性在Access 97中不存在。

Select Case ref.Major

 Case 8: i = 6 'Access 97

 Case 9: i = 7 'Access XP

Case Else

 MsgBox "未知版本,无法使用此功能"

 Exit Sub

End Select



 With CommandBars.Add(, msoBarFloating, , True)

  

   .Controls.Add msoControlButton, CommandBars("Tools").Controls(i).CommandBar.Controls(2).Id

   DoEvents

   .Visible = True

   .Controls(1).SetFocus

   SendKeys "{ENTER}" '模拟击键压缩

  End With

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-8 11:10 , Processed in 0.093851 second(s), 23 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表