📄 frmbackuptest.frm
字号:
VERSION 5.00
Object = "{1B51D052-02A7-11D1-9AF0-004033373A8F}#4.0#0"; "EnhancedTimer.ocx"
Begin VB.Form frmBackupTest
Caption = "Backup Test Form"
ClientHeight = 1350
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 1350
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin prjEnhancedTimer.ctlEnhancedTimer ctlEnhancedTimer1
Left = 480
Top = 720
_ExtentX = 741
_ExtentY = 741
End
Begin VB.CommandButton cmdStartTimer
Caption = "&Start Timer"
Height = 375
Left = 1200
TabIndex = 2
Top = 720
Width = 3135
End
Begin VB.TextBox txtTriggerTime
Height = 375
Left = 1200
TabIndex = 0
Top = 240
Width = 3135
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Trigger Time:"
Height = 195
Left = 120
TabIndex = 1
Top = 240
Width = 930
End
End
Attribute VB_Name = "frmBackupTest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private usrBackupTable As New clsBackupTable
Private dbOpenDb As Database
Private Sub cmdStartTimer_Click()
' Start the timer
If Not IsDate(txtTriggerTime.Text) Then
MsgBox "Invalid time format"
Else
ctlEnhancedTimer1.TimeToTrigger = txtTriggerTime.Text
ctlEnhancedTimer1.Enabled = True
End If
End Sub
Private Sub ctlEnhancedTimer1_ExtendedTimerPop()
On Error GoTo BackupError
Debug.Print "Extended timer pop"
usrBackupTable.DoBackup
' Restart the timer
ctlEnhancedTimer1.Enabled = True
Exit Sub
BackupError:
MsgBox Err.Description & " from " & Err.Source _
& " Number = " & CStr(Err.Number)
Exit Sub
End Sub
Private Sub Form_Load()
Dim strDbName As String
On Error GoTo DbError
strDbName = App.Path & "\Expense.mdb"
' Open a database for the Backup class to use
Set dbOpenDb = Workspaces(0).OpenDatabase(strDbName)
Set usrBackupTable.DatabaseObject = dbOpenDb
usrBackupTable.TableName = "Expenses"
Exit Sub
DbError:
MsgBox Err.Description & " from " & Err.Source _
& " Number = " & CStr(Err.Number)
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -