📄 frmstatstudent.frm
字号:
VERSION 5.00
Object = "{65E121D4-0C60-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCHRT20.OCX"
Begin VB.Form frmStatStudent
Caption = "学员信息统计窗口"
ClientHeight = 3195
ClientLeft = -3705
ClientTop = 1365
ClientWidth = 7380
Icon = "frmStatStudent.frx":0000
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 3195
ScaleWidth = 7380
Begin MSChart20Lib.MSChart MSChart1
Height = 3372
Left = 3840
OleObjectBlob = "frmStatStudent.frx":0E42
TabIndex = 7
Top = -600
Width = 3612
End
Begin VB.CommandButton cmdQuery
Caption = "查 询"
Height = 375
Left = 450
Style = 1 'Graphical
TabIndex = 5
Top = 2520
Width = 1215
End
Begin VB.CommandButton cmdExit
Caption = "退 出"
Height = 375
Left = 2130
Style = 1 'Graphical
TabIndex = 6
Top = 2520
Width = 1335
End
Begin VB.Frame famQuery
Caption = "考试及格率统计"
Height = 1935
Left = 330
TabIndex = 0
Top = 240
Width = 3255
Begin VB.OptionButton optSMCode
Caption = "按 学 年"
Height = 375
Left = 480
TabIndex = 2
Top = 1080
Width = 1095
End
Begin VB.OptionButton optBCode
Caption = "按 班 级"
Height = 375
Left = 480
TabIndex = 1
Top = 480
Width = 1215
End
Begin VB.ComboBox cmbBCode
Height = 300
Left = 1680
TabIndex = 3
Text = "cmbCenterName"
Top = 480
Width = 1215
End
Begin VB.ComboBox cmbSMCode
Height = 300
Left = 1680
TabIndex = 4
Text = "cmbProvince"
Top = 1080
Width = 1215
End
End
End
Attribute VB_Name = "frmStatStudent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdExit_Click()
'关闭记录集,RsClose函数 见模块MdlConnection
RsClose rs
'关闭窗体
Unload Me
End Sub
Private Sub cmdQuery_Click()
Dim strTemp As String
If optBCode.Value = False And optSMCode = False Then
MsgBox "您没选择任何统计类型" & Chr(10) & "请选择至少一种!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If optBCode.Value = True Then
If cmbBCode.Text = "" Then
MsgBox "您选择了按班级统计" & Chr(10) & "请选择班级!", vbOKOnly + vbExclamation, "提示"
Exit Sub
Else
strTemp = " bcode='" & Trim(cmbBCode.Text) & "' "
End If
End If
If optSMCode.Value = True Then
If cmbSMCode.Text = "" Then
MsgBox "您选择了按学期统计" & Chr(10) & "请选择学期!", vbOKOnly + vbExclamation, "提示"
Exit Sub
Else
strTemp = " smcode='" & Trim(cmbSMCode.Text) & "' "
End If
End If
strFind = "select * from studenthistory where " & strTemp & " and " & " status='毕业未获证' "
'Debug.Print strFind
RsClose rs
'打开表syscenterinfo,创建记录集
RsOpen rs, con, strFind, "adcmdtext"
Dim intCount As Integer
intCount = 0
Do While (Not rs.EOF)
intCount = intCount + 1
rs.MoveNext
Loop
RsClose rs
strFind = "select * from studenthistory where " & strTemp & " and " & " status='已获认证' "
'Debug.Print strFind
RsClose rs
'打开表syscenterinfo,创建记录集
RsOpen rs, con, strFind, "adcmdtext"
Dim intCount2 As Integer
intCount2 = 0
Do While (Not rs.EOF)
intCount2 = intCount2 + 1
rs.MoveNext
Loop
RsClose rs
If intCount = 0 And intCount2 = 0 Then
MsgBox "数据不足无法统计!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
Dim pass As Single
pass = intCount2 / (intCount + intCount2)
With MSChart1
.RowLabel = "及格率" & Format(pass, "0.00%")
.Column = 1
.ColumnLabel = "不及格比例:"
.Data = intCount
.Column = 2
.ColumnLabel = "及格比例:"
.Data = intCount2
End With
frmStatStudent.Width = 7500
End Sub
Private Sub Form_Load()
'设置窗体的背景色为GetColor函数的返回值,GetColor函数 见模块MdlSystem
Me.BackColor = GetColor
Me.Width = 4000
Me.Height = 3600
'遍历窗体上的所有控件,改变颜色为GetColor函数的返回值(GetColor函数 见模块MdlSystem)
Dim ctlcontrol As Control
For Each ctlcontrol In Controls
If TypeOf ctlcontrol Is MSChart Then
Else
ctlcontrol.BackColor = GetColor
End If
Next
'向组合框添入数据
DisplayRefresh
With MSChart1
.Column = 1
.ColumnLabel = "及格比例:"
.Column = 2
.ColumnLabel = "不及格比例:"
End With
End Sub
Private Sub DisplayRefresh()
Dim ctlcontrol As Control
'清空组合框文本显示
For Each ctlcontrol In Controls
If TypeOf ctlcontrol Is ComboBox Then
ctlcontrol.Clear
ctlcontrol.Enabled = False
End If
Next
cmbSMCode.AddItem "S1"
cmbSMCode.AddItem "S2"
cmbSMCode.AddItem "Y2"
'从表studenthistory中取得班级编号,放入cmbBCode中
RsClose rsTemp
strFind = "select distinct bcode from studenthistory "
RsOpen rsTemp, con, strFind, "adcmdtext"
Do While (rsTemp.EOF = False)
cmbBCode.AddItem rsTemp.Fields("bcode")
rsTemp.MoveNext
Loop
RsClose rsTemp
End Sub
Private Sub optBCode_Click()
If optBCode.Value = True Then
cmbBCode.Enabled = True
cmbSMCode.Enabled = False
End If
End Sub
Private Sub optSMCode_Click()
If optSMCode.Value = True Then
cmbSMCode.Enabled = True
cmbBCode.Enabled = False
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -