📄 form5.frm
字号:
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc3
Height = 375
Left = 2280
Top = 1680
Width = 1215
_ExtentX = 2143
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = 0
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc4
Height = 375
Left = 3600
Top = 1680
Width = 1215
_ExtentX = 2143
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = 0
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click()
Dim i As Integer
If Check1.Value = 1 Then
Call Check3_Click
Combo1.Enabled = True
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\data.MDe;Persist Security Info=False"
Adodc2.CommandType = adCmdText
SQL = "select distinct 学期 from liebie"
Adodc2.RecordSource = SQL
Adodc2.Refresh
For i = 0 To Adodc2.Recordset.RecordCount - 1
Combo1.List(i) = Adodc2.Recordset.Fields(0)
Adodc2.Recordset.MoveNext
Next
Adodc2.Recordset.MoveFirst
Combo1.Text = Adodc2.Recordset.Fields(0)
Else
Combo1.Enabled = False
End If
Call Check3_Click
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
Call Check3_Click
Combo2.Enabled = True
Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\data.MDe;Persist Security Info=False"
Adodc3.CommandType = adCmdText
SQL = "select distinct 分类 from liebie"
Adodc3.RecordSource = SQL
Adodc3.Refresh
On Error Resume Next
For i = 0 To Adodc3.Recordset.RecordCount - 1
Combo2.List(i) = Adodc3.Recordset.Fields(0)
Adodc3.Recordset.MoveNext
Next
Adodc3.Recordset.MoveFirst
Combo2.Text = Adodc3.Recordset.Fields(0)
Else
Combo2.Enabled = False
End If
Call Check3_Click
End Sub
Private Sub Check3_Click()
Dim str As String
Dim tiaojian As Integer
tiaojian = 0
Combo4.Clear
If Check3.Value = 1 Then
Combo4.Enabled = True
If Check1.Value = 1 Then
tiaojian = 1
End If
If Check2.Value = 1 Then
tiaojian = 2
End If
If Check1.Value = 1 And Check2.Value = 1 Then
tiaojian = 3
End If
'MsgBox tiaojian
If tiaojian = 0 Then
str = "select distinct 科目 from liebie"
End If
If tiaojian = 1 Then
str = "select distinct 科目 from liebie where 学期 = " & Val(Combo1.Text)
End If
If tiaojian = 2 Then
str = "select distinct 科目 from liebie where 分类 = " & Val(Combo2.Text)
End If
If tiaojian = 3 Then
str = "select distinct 科目 from liebie where 学期 = " & Val(Combo1.Text) & " and 分类 = " & Val(Combo2.Text)
End If
'MsgBox str
Adodc4.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\data.MDe;Persist Security Info=False"
Adodc4.CommandType = adCmdText
SQL = str
Adodc4.RecordSource = SQL
Adodc4.Refresh
For i = 0 To Adodc4.Recordset.RecordCount - 1
Combo4.List(i) = Adodc4.Recordset.Fields(0)
Adodc4.Recordset.MoveNext
Next
'Adodc4.Recordset.MoveFirst
'Combo4.Text = Adodc4.Recordset.Fields(0)
Else
Combo4.Enabled = False
End If
End Sub
Private Sub Check4_Click()
If Check4.Value = 1 Then
Combo3.Enabled = True
Option1(0).Enabled = True
Option1(1).Enabled = True
Option1(0).Value = True
Else
Option1(0).Enabled = False
Option1(1).Enabled = False
Combo3.Enabled = False
End If
End Sub
Private Sub Combo1_Click()
Call Check3_Click
End Sub
Private Sub Combo2_Click()
Call Check3_Click
End Sub
Private Sub Command1_Click()
Dim tiaojian As Integer
Dim str As String
Dim strend As String
str = "select data.学号,data.姓名,chengji.学期,chengji.科目,chengji.成绩,liebie.分类 from data,chengji,liebie where data.学号=chengji.学号 and chengji.学期=liebie.学期 and chengji.科目=liebie.科目 "
strend = " order by data.学号,chengji.学期"
If Check1.Value = 1 Then
str = str & " and liebie.学期 = " & Val(Combo1.Text)
End If
If Check2.Value = 1 Then
str = str & " and liebie.分类 = " & Val(Combo2.Text)
End If
If Check3.Value = 1 Then
str = str & " and liebie.科目 = '" & Combo4.Text & "'"
End If
If Check4.Value = 1 Then
If Option1(0).Value = True Then
str = str & " and chengji.成绩 >= " & Val(Combo3.Text)
Else
str = str & " and chengji.成绩 <= " & Val(Combo3.Text)
End If
End If
str = str & strend
'MsgBox str
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\data.MDe;Persist Security Info=False"
Adodc1.CommandType = adCmdText
SQL = str
Adodc1.RecordSource = SQL
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
'Adodc1.Recordset.Filter = adFilterNone
c = Adodc1.Recordset.RecordCount
Adodc1.Recordset.MoveFirst
a = Adodc1.Recordset("姓名")
b = Adodc1.Recordset("成绩")
s = s + b
p = IIf(b < 60, a & ",", "")
For n = 1 To c - 1
Adodc1.Recordset.MoveNext
a = Adodc1.Recordset("姓名")
b = Adodc1.Recordset("成绩")
s = s + b
p = IIf(b < 60, p & a & ",", p)
Next
p = IIf(p <> "", "不及格的同学有:" & p, "")
MsgBox bj & km & "全班同学成绩平均分:" & (s / c) & " ,总分为:" & s & Chr(13) & p, , "系统统计"
End Sub
Private Sub Form_Load()
Option1(0).Enabled = False
Option1(1).Enabled = False
Combo1.Enabled = False
Combo2.Enabled = False
Combo3.Enabled = False
Combo4.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -