|
'在程序退出前调用下面代码,即可实现当文件到达一定大小才压缩数据库
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
Application.SetOption ("Auto Compact"), 1 '压缩
Else
Application.SetOption ("Auto Compact"), 0 '不压缩
End If
End Function
|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )
GMT+8, 2024-5-25 17:12 , Processed in 0.052626 second(s), 15 queries .
Powered by Discuz! X3.3
© 2001-2017 Comsenz Inc.