压缩、修复指定的数据库
时间:2006-11-21 22:39 来源:IT学院 作者:Grant 阅读:次
压缩、修复指定的数据库
Public Function RepairDatabase(strSource As String) As Boolean
On Error GoTo error_handler
Dim I As Integer
'生成压缩后的文件名
Dim strDestination As String
I = 1
Do
strDestination = strSource & I
If Dir(strSource & I) = "" Then
Exit Do
Else
I = I + 1
End If
Loop
'压缩修复指定文件
RepairDatabase = _
Application.CompactRepair( _
LogFile:=True, _
SourceFile:=strSource, _
DestinationFile:=strDestination)
'压缩完成后删除原文件
Kill strSource
'把压缩后的文件名改成原文件名
Name strDestination As strSource
On Error GoTo 0
Exit Function
error_handler:
RepairDatabase = False
End Function
Public Function RepairDatabase(strSource As String) As Boolean
On Error GoTo error_handler
Dim I As Integer
'生成压缩后的文件名
Dim strDestination As String
I = 1
Do
strDestination = strSource & I
If Dir(strSource & I) = "" Then
Exit Do
Else
I = I + 1
End If
Loop
'压缩修复指定文件
RepairDatabase = _
Application.CompactRepair( _
LogFile:=True, _
SourceFile:=strSource, _
DestinationFile:=strDestination)
'压缩完成后删除原文件
Kill strSource
'把压缩后的文件名改成原文件名
Name strDestination As strSource
On Error GoTo 0
Exit Function
error_handler:
RepairDatabase = False
End Function
(责任编辑:admin)
顶一下
(0)
0%
踩一下
(0)
0%
相关内容
最新内容
推荐内容