【VB开源代码栏目提醒】:本文主要为网学会员提供C提醒统计.frm,希望对需要C提醒统计.frm网友有所帮助,学习一下!
VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomct2.ocx"
Begin VB.Form frmremindStatistics
Caption = "提醒统计"
ClientHeight = 3150
ClientLeft = 60
ClientTop = 450
ClientWidth = 7650
LinkTopic = "Form1"
ScaleHeight = 3150
ScaleWidth = 7650
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "提醒统计"
Height = 3015
Left = 0
TabIndex = 0
Top = 0
Width = 7455
Begin VB.Frame Frame3
Caption = "统计条件"
Height = 2595
Left = 4320
TabIndex = 2
Top = 180
Width = 2895
Begin VB.CommandButton CmdExit
BackColor = &H00C0C0C0&
Caption = "退出"
Height = 360
Left = 1500
Style = 1 'Graphical
TabIndex = 10
Top = 1920
Width = 795
End
Begin VB.OptionButton Option1
Caption = "提醒时间"
Height = 375
Index = 2
Left = 240
TabIndex = 7
Top = 960
Width = 1095
End
Begin VB.OptionButton Option1
Caption = "提醒对象"
Height = 375
Index = 1
Left = 240
TabIndex = 6
Top = 600
Width = 1095
End
Begin VB.OptionButton Option1
Caption = "联系人"
Height = 375
Index = 0
Left = 240
TabIndex = 5
Top = 240
Value = -1 'True
Width = 975
End
Begin VB.TextBox txtValue
Appearance = 0 'Flat
Height = 375
Left = 960
TabIndex = 4
Top = 1380
Width = 1575
End
Begin VB.CommandButton CmdCount
BackColor = &H00C0C0C0&
Caption = "统计"
Height = 360
Left = 240
Style = 1 'Graphical
TabIndex = 3
Top = 1920
Width = 795
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 960
TabIndex = 8
Top = 1440
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_ExtentY = 661
_Version = 393216
Format = 21168129
CurrentDate = 38923
End
Begin VB.Label Label1
Caption = "条件值:"
Height = 255
Left = 120
TabIndex = 9
Top = 1440
Width = 735
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 2535
Left = 120
TabIndex = 1
Top = 240
Width = 4095
_ExtentX = 7223
_ExtentY = 4471
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "通讯提醒统计列表"
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
End
Attribute VB_Name = "frmremindStatistics"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs As ADODB.Recordset
Dim SQL As String
Dim msg As String
Dim Index As Integer
Dim CountValue '保存统计条件
Private Sub CmdCount_Click()
'统计操作
Call GetSQL '得到要统计的SQL语句
Set rs = Nothing
Set rs = SelectSQL(SQL, msg)
If rs.RecordCount <> 0 Then
Set Me.DataGrid1.DataSource = rs
Else
Set Me.DataGrid1.DataSource = Nothing
End If
End Sub
Private Sub GetSQL()
'得到要统计的SQL语句
'按联系人统计
If Option1(0).Value Then
SQL = "Select contactPerson,ifCompleted,count(remindID) as 提醒次数 from 提醒信息表 "
SQL = SQL & " where contactPerson like '%" & Trim(txtValue) & "' GROUP BY contactPers