📄 babackupdb1.frm
字号:
VERSION 5.00
Begin VB.Form BABackUpDB1
Caption = "数据备份"
ClientHeight = 2310
ClientLeft = 60
ClientTop = 465
ClientWidth = 4875
LinkTopic = "Form1"
ScaleHeight = 2310
ScaleWidth = 4875
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1000
Left = 270
Top = 1890
End
Begin VB.CommandButton Command2
Caption = "关闭"
Height = 525
Left = 3120
TabIndex = 4
Top = 1020
Width = 1245
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 525
Left = 3120
TabIndex = 3
Top = 390
Width = 1245
End
Begin VB.OptionButton Option2
Caption = "手动备份"
Height = 525
Left = 1020
TabIndex = 2
Top = 1020
Width = 1245
End
Begin VB.OptionButton Option1
Caption = "自动备份"
Height = 525
Left = 1050
TabIndex = 1
Top = 450
Width = 1245
End
Begin VB.Frame Frame1
Caption = "备份方式"
Height = 1665
Left = 120
TabIndex = 0
Top = 90
Width = 4455
End
Begin VB.Label Label1
Caption = "Label1"
Height = 375
Left = 240
TabIndex = 5
Top = 1860
Width = 4425
End
End
Attribute VB_Name = "BABackUpDB1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim settingTime As Integer
Dim old_time As Date, new_time As Date
Private Sub Command1_Click()
On Error GoTo kkk
Dim settingTimeString As String
If Option1.value = True Then
settingTimeString = InputBox("请输入备份间隔的时间天数(默认30天):", "数据备份", "30")
If settingTimeString = "" Then Exit Sub
settingTime = settingTimeString
MsgBox ("设置成功!")
Me.Visible = False
' Unload Me
End If
If Option2.value = True Then
Label1.Caption = ""
Label1.Caption = "正在手动备份到默认目录,请稍后..."
fBackByHand = fBackupDatabase_a("d:\byHand" & CStr(Format(Date, "yyyymmdd")), BADBN) '按日期作为存储名
MsgBox fBackByHand
Label1.Caption = ""
End If
Exit Sub
kkk:
MsgBox ("请输入正确天数!")
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
old_time = Date
settingTime = 30
Label1.Caption = old_time
Option2.value = False
Option1.value = True
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
'Text1.text = "ddd"
new_time = Date
If new_time - old_time >= settingTime Then
'Text1.text = "哈哈,时间到!"
'DISK='E:\job_DB\vb_example1\" & CStr(Format(Date, "yyyy-mm-dd")) & ".bak'"
fBack = fBackupDatabase_a("E:\" & CStr(Format(Date, "yyyymmdd")), BADBN) '按日期作为存储名
MsgBox fBack
old_time = Date
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -