⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmdelete.frm

📁 基于VC++串口编程。经过好长时间的寻找
💻 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 frmDelete 
   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        =   7
      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        =   6
      Top             =   816
      Width           =   1140
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "确认"
      Default         =   -1  'True
      Height          =   360
      Left            =   5196
      TabIndex        =   5
      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        =   1
      Top             =   1560
      Width           =   1932
      _ExtentX        =   3413
      _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        =   8
      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        =   4
      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        =   3
      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
   Begin VB.Label Label2 
      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        =   2
      Top             =   264
      Width           =   4080
   End
   Begin VB.Label Label1 
      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        =   0
      Top             =   708
      Width           =   4080
   End
End
Attribute VB_Name = "frmDelete"
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 + -