![]() ![]() |
|
当Access文件大于指定的大小时就自动压缩 | |
作者:佚名 文章来源:不详 点击数 更新时间:2008/4/18 14:55:04 文章录入:杜斌 责任编辑:杜斌 | |
|
|
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 ‘修改此处的20M为你自己需要的值 Application.SetOption ("Auto Compact"), 1 ‘压缩程序 Else Application.SetOption ("Auto Compact"), 0 ‘不压缩程序 End If End Function 在任何退出的程序前调用这个函数,例如在Docmd.Quit前调用: |
|
![]() ![]() |