📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "压缩数据库文件"
ClientHeight = 2055
ClientLeft = 60
ClientTop = 345
ClientWidth = 4470
LinkTopic = "Form1"
ScaleHeight = 2055
ScaleWidth = 4470
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command3
Caption = "退出"
Height = 495
Left = 3000
TabIndex = 4
Top = 1335
Width = 1320
End
Begin VB.CheckBox Check1
Appearance = 0 'Flat
BackColor = &H80000004&
Caption = "压缩前请备份数据库"
ForeColor = &H80000008&
Height = 300
Left = 120
TabIndex = 3
Top = 945
Value = 1 'Checked
Width = 1935
End
Begin VB.TextBox Text1
Height = 375
Left = 120
TabIndex = 1
Text = "Text1"
Top = 480
Width = 4140
End
Begin VB.CommandButton Command1
Caption = "开始压缩"
Height = 525
Left = 360
Style = 1 'Graphical
TabIndex = 0
Top = 1350
Width = 2595
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "要修复的数据库"
Height = 180
Left = 135
TabIndex = 2
Top = 150
Width = 1260
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Text1.Text = App.Path & "\db1.mdb"
End Sub
Private Sub Command1_Click()
On Error Resume Next
Dim sNewName As String
Dim sBakFile As String
sNewName = Text1.Text
sDatabase = sNewName
MousePointer = 11
sNewFile = Left$(sDatabase, Len(sDatabase) - 3) & "NEW"
sBakFile = Left$(sDatabase, Len(sDatabase) - 3) & "BAK"
If Check1.Value = 1 Then
Name sDatabase As sBakFile '备份数据库
End If
DBEngine.RepairDatabase sDatabase '修复数据库
If Dir(sNewFile) <> "" Then
Kill sNewFile
End If
DBEngine.CompactDatabase sDatabase, sNewFile '压缩数据库
If Dir(sBakFile) <> "" Then
Kill sBakFile
End If
If Dir(sDatabase) <> "" Then
Kill sDatabase
End If
Name sNewFile As sDatabase
bCompactMDB = True
MousePointer = 0
MousePointer = 0
MsgBox "压缩数据库完成"
End Sub
Private Sub Command3_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -