📄 frmbjfsdfx.frm
字号:
EndProperty
ForeColor = &H000040C0&
Height = 240
Left = 1080
TabIndex = 29
Top = 840
Width = 150
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "人数"
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 240
Left = 360
TabIndex = 28
Top = 840
Width = 525
End
Begin VB.Label TxtCount
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "华文隶书"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 285
Index = 6
Left = 7320
TabIndex = 20
Top = 840
Width = 105
End
Begin VB.Label TxtCount
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "华文隶书"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 285
Index = 5
Left = 6360
TabIndex = 19
Top = 840
Width = 105
End
Begin VB.Label TxtCount
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "华文隶书"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 285
Index = 4
Left = 5400
TabIndex = 18
Top = 840
Width = 105
End
Begin VB.Label TxtCount
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "华文隶书"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 285
Index = 3
Left = 4440
TabIndex = 17
Top = 840
Width = 105
End
Begin VB.Label TxtCount
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "华文隶书"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 285
Index = 2
Left = 3480
TabIndex = 16
Top = 840
Width = 105
End
Begin VB.Label TxtCount
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "华文隶书"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 285
Index = 1
Left = 2520
TabIndex = 15
Top = 840
Width = 105
End
Begin VB.Label TxtCount
AutoSize = -1 'True
BackStyle = 0 'Transparent
BeginProperty Font
Name = "华文隶书"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 285
Index = 0
Left = 1560
TabIndex = 14
Top = 840
Width = 105
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学科:"
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 2280
TabIndex = 13
Top = 120
Width = 780
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "分数段"
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C000C0&
Height = 240
Left = 240
TabIndex = 10
Top = 480
Width = 780
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "班级:"
BeginProperty Font
Name = "黑体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 360
TabIndex = 1
Top = 120
Width = 780
End
End
Attribute VB_Name = "FrmBjfsdfx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Icj(0 To 7) As Integer
Private Sub CmdExec_Click()
If Combo1.ListIndex = -1 Or Combo2.ListIndex = -1 Or Combo3.ListIndex = -1 Then
MsgBox "请确保选择统计班级、学科和考试性质!"
Exit Sub
End If
DataOut
ExecPass
LoadData
End Sub
Private Sub ComLst_Click(Index As Integer)
If ComLst(Index).ListIndex > -1 And Combo3.ListIndex > -1 Then
Dim txtSQL As String
txtSQL = "select b.班级,b.学号,b.姓名,a.* from 成绩表 AS a INNER JOIN 学籍表 AS b ON a.考试号 = b.考试号 where 姓名 = '" & ComLst(Index).Text & "' and 考试性质 = '" & Combo3.Text & "'"
Adodc1.ConnectionString = Con.ConnectionString
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = txtSQL
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End If
End Sub
Private Sub Form_Load()
Call ResizeInit(Me)
Dim Rsb As ADODB.Recordset
Set Rsb = New ADODB.Recordset
Rsb.Open "select distinct b.班级 as KsBJ from 成绩表 AS a INNER JOIN 学籍表 AS b ON a.考试号 = b.考试号 ", Con, adOpenStatic, , adCmdText
Combo1.Clear
Do While Not Rsb.EOF
Combo1.AddItem Rsb!KsBJ
Rsb.MoveNext
Loop
Set Rsx = New ADODB.Recordset
Rsx.Open "select distinct a.考试性质 as Ksxz from 成绩表 AS a INNER JOIN 学籍表 AS b ON a.考试号 = b.考试号 ", Con, adOpenStatic, , adCmdText
Combo3.Clear
Do While Not Rsx.EOF
Combo3.AddItem Rsx!Ksxz
Rsx.MoveNext
Loop
If Combo1.ListCount > 0 Then
Combo1.ListIndex = 0
Combo2.ListIndex = 9
End If
If Combo3.ListCount > 0 Then
Combo3.ListIndex = 0
End If
End Sub
Private Sub Form_Resize()
Call ResizeForm(Me) '窗体改变时,控件随之变化
Combo1.Left = Label1.Left + Label1.Width + 100
Combo1.Top = Label1.Top
Combo1.Width = Label1.Width + 150
Combo2.Left = Label3.Left + Label3.Width + 100
Combo2.Top = Label3.Top
Combo2.Width = Label3.Width + 150
Combo3.Left = Label6.Left + Label6.Width + 100
Combo3.Top = Label6.Top
Combo3.Width = Label6.Width + 150
For i = 0 To 7
ComLst(i).Top = Label7.Top
ComLst(i).Left = TxtFsd(i).Left + i * 10
ComLst(i).Width = ComLst(i).Width
Next i
End Sub
Private Sub TxtFsd_KeyPress(Index As Integer, KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) Then
KeyAscii = 0
End If
End Sub
Private Sub ExecPass()
For i = 0 To 7
If TxtFsd(i).Text = "" Then
MsgBox "分数段数值错误!此次统计不实。", , "错误项" & i & ":"
Exit Sub
End If
Next i
If CInt(TxtFsd(0).Text) > CInt(TxtFsd(1).Text) And CInt(TxtFsd(1).Text) > CInt(TxtFsd(2).Text) And CInt(TxtFsd(2).Text) > CInt(TxtFsd(3).Text) And CInt(TxtFsd(3).Text) > CInt(TxtFsd(4).Text) And CInt(TxtFsd(4).Text) > CInt(TxtFsd(5).Text) And CInt(TxtFsd(5).Text) > CInt(TxtFsd(6).Text) And CInt(TxtFsd(6).Text) > CInt(TxtFsd(7).Text) Then
Else
MsgBox "请保持数值递减顺序!此次统计不实。", , "数值错误:"
Exit Sub
End If
End Sub
Private Sub LoadData()
Dim Query As String
Dim PicRs As ADODB.Recordset
Set PicRs = New ADODB.Recordset
Query = "select b.姓名 as xm , a." & Combo2.Text & " as Cj from 成绩表 AS a INNER JOIN 学籍表 AS b ON a.考试号 = b.考试号 where 班级 = '" & Combo1.Text & "' and 考试性质 = '" & Combo3.Text & "'"
PicRs.Open Query, Con, adOpenStatic, , adCmdText
With PicRs
Do While Not .EOF
If CInt(PicRs!cj) >= CInt(TxtFsd(0).Text) Then
Icj(0) = Icj(0) + 1
ComLst(0).AddItem PicRs!XM
End If
If CInt(PicRs!cj) >= CInt(TxtFsd(1).Text) And CInt(PicRs!cj) < CInt(TxtFsd(0).Text) Then
Icj(1) = Icj(1) + 1
ComLst(1).AddItem PicRs!XM
End If
If CInt(PicRs!cj) >= CInt(TxtFsd(2).Text) And CInt(PicRs!cj) < CInt(TxtFsd(1).Text) Then
Icj(2) = Icj(2) + 1
ComLst(2).AddItem PicRs!XM
End If
If CInt(PicRs!cj) >= CInt(TxtFsd(3).Text) And CInt(PicRs!cj) < CInt(TxtFsd(2).Text) Then
Icj(3) = Icj(3) + 1
ComLst(3).AddItem PicRs!XM
End If
If CInt(PicRs!cj) >= CInt(TxtFsd(4).Text) And CInt(PicRs!cj) < CInt(TxtFsd(3).Text) Then
Icj(4) = Icj(4) + 1
ComLst(4).AddItem PicRs!XM
End If
If CInt(PicRs!cj) >= CInt(TxtFsd(5).Text) And CInt(PicRs!cj) < CInt(TxtFsd(4).Text) Then
Icj(5) = Icj(5) + 1
ComLst(5).AddItem PicRs!XM
End If
If CInt(PicRs!cj) >= CInt(TxtFsd(6).Text) And CInt(PicRs!cj) < CInt(TxtFsd(5).Text) Then
Icj(6) = Icj(6) + 1
ComLst(6).AddItem PicRs!XM
End If
If CInt(PicRs!cj) >= CInt(TxtFsd(7).Text) And CInt(PicRs!cj) < CInt(TxtFsd(6).Text) Then
Icj(7) = Icj(7) + 1
ComLst(7).AddItem PicRs!XM
End If
.MoveNext
Loop
End With
Label5.Caption = PicRs.RecordCount
For i = 0 To 7
TxtCount(i).Caption = Icj(i)
Next i
PicRs.Close
End Sub
Private Sub DataOut()
For i = 0 To 7
Icj(i) = 0
ComLst(i).Clear
ComLst(i).Text = "请选"
TxtCount(i).Caption = ""
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -