适用 Access2000及以后版本
翻译:tmtony(Access/Office中国)
首先在公共模块添加如下函数:
Public Function AutoCompactCurrentProject()
Dim fs, f, s, filespec
Dim strProjectPath As String, strProjectName As String
strProjectPath = Application.CurrentProject.Path
strProjectName = Application.CurrentProject.Name
filespec = strProjectPath & "" & strProjectName
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = CLng(f.Size / 1000000) ‘转换文件大小为MB
If s 20 Then ...[ 查看全文 ]