?? frmdelete.frm
字號:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form frmDel
BorderStyle = 3 'Fixed Dialog
Caption = "刪除記錄"
ClientHeight = 2640
ClientLeft = 30
ClientTop = 330
ClientWidth = 6540
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmDelete.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2640
ScaleWidth = 6540
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin MSComctlLib.ProgressBar ProgressBar1
Align = 2 'Align Bottom
Height = 225
Left = 0
TabIndex = 5
Top = 2415
Visible = 0 'False
Width = 6540
_ExtentX = 11536
_ExtentY = 397
_Version = 393216
Appearance = 1
End
Begin VB.CommandButton Command2
Cancel = -1 'True
Caption = "取消"
Height = 360
Left = 5196
TabIndex = 4
Top = 816
Width = 1140
End
Begin VB.CommandButton cmdOK
Caption = "確認"
Default = -1 'True
Height = 360
Left = 5196
TabIndex = 3
Top = 240
Width = 1140
End
Begin MSMask.MaskEdBox txtDay
BeginProperty DataFormat
Type = 1
Format = "yyyy""年""M""月""d""日"""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 3
EndProperty
Height = 396
Left = 984
TabIndex = 0
Top = 1560
Width = 1932
_ExtentX = 3387
_ExtentY = 688
_Version = 393216
MaxLength = 11
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Mask = "####年##月##日"
PromptChar = "_"
End
Begin VB.Label LabRecCount
AutoSize = -1 'True
Caption = "Label5"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 216
Left = 84
TabIndex = 6
Top = 2124
Visible = 0 'False
Width = 648
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "(不含當日)以前的記錄。"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 3000
TabIndex = 2
Top = 1620
Width = 2640
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "確認刪除"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 984
TabIndex = 1
Top = 1200
Width = 960
End
Begin VB.Image Image1
Height = 684
Left = 180
Picture = "frmDelete.frx":030A
Stretch = -1 'True
Top = 192
Width = 636
End
End
Attribute VB_Name = "frmDel"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdOK_Click()
Dim rs As Recordset
Dim Answer As Integer
Dim sQuery As QueryDef, sSql As String
If IsDate(txtDay.Text) = False Then
MsgBox "您輸入的日期格式不正確,請確定一個正確日期!"
txtDay.SetFocus
Exit Sub
ElseIf (CDate(txtDay.Text) + 182) > Date Then
Answer = MsgBox("您要刪除的記錄包含半年以內的部分數據,確認刪除嗎?", vbQuestion + vbYesNo, "警告")
If Answer = vbNo Then
txtDay.SetFocus
Exit Sub
End If
End If
Dim i As Integer, sFile As String
Dim nRecDeleted As Integer
'開始刪除
sSql = "Select * from tabCaptureRec where fldCapDate < #" & Format(CDate(txtDay.Text)) & "#"
Set rs = g_myDB.OpenRecordset(sSql)
If Not rs.EOF Then
rs.MoveLast
nRecDeleted = rs.RecordCount
LabRecCount.Caption = "總計" & nRecDeleted & "條記錄"
ProgressBar1.Min = 0
ProgressBar1.Max = nRecDeleted
ProgressBar1.Value = 0
LabRecCount.Visible = True
ProgressBar1.Visible = True
DoEvents
cmdOK.Enabled = False
Command2.Enabled = False
rs.MoveFirst
For i = 1 To nRecDeleted
sFile = GetAppPath & "Jpg\" & rs!fldJpgFile
Kill sFile
rs.Delete
rs.MoveNext
ProgressBar1.Value = ProgressBar1.Value + 1
Next i
MsgBox "共刪除了 " & nRecDeleted & " 條記錄!"
g_bDeleted = True '標記已經刪除了
Else
MsgBox "沒有可刪除記錄!"
End If
rs.Close
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
'加載半年前時間
txtDay.Mask = ""
txtDay.Text = Format(Date - 182, "Long Date")
g_bDeleted = False
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -