VB+Access学生信息管理系统 第8页
If Val(Combo8) > Val(Combo11) Then
MsgBox "请正确选择日期!", vbOKOnly + vbExclamation, "信息提示"
Combo8.SetFocus
Exit Sub
End If
End If
End If
End If
End If
If Combo6.Text = "" Or Combo7.Text = "" Or Combo8.Text = "" Or Combo9.Text = "" Or Combo10.Text = "" Or Combo11.Text = "" Then
MsgBox "请输入完整的日期", vbOKOnly, "警告"
Exit Sub
End If
str1 = Trim(Combo6) & "-" & Trim(Combo7) & "-" & Trim(Combo8)
str2 = Trim(Combo9) & "-" & Trim(Combo10) & "-" & Trim(Combo11)
str1 = Format(str1, "yyyy-mm-dd")
str2 = Format(str2, "yyyy-mm-dd")
If sqlstr = "" Then
sqlstr = "" & Trim(Combo5.Text) & ">=#" & Format(str1, "yyyy-mm-dd") & "# and " & Trim(Combo5.Text) & "<= #" & Format(str2, "yyyy-mm-dd") & "#"
Else
sqlstr = sqlstr & " and " & Trim(Combo5.Text) & ">=#" & Format(str1, "yyyy-mm-dd") & "# and " & Trim(Combo5.Text) & "<= #" & Format(str2, "yyyy-mm-dd") & "#"
End If
If sqlstr = "" Then
MsgBox "请先输入查找时间!"
Exit Sub
End If
strTiaoJian = "select 专业,年级,学期,课程名称,教材,任课老师,课时,上课地点,课程性质,考试性质 from 课程表 where " & sqlstr
Unload Me
Frm_UpdateGrean.Show 1
End If
If Option3.Value <> True And Option4.Value <> True Then
MsgBox "请选择查询方式!", vbOKOnly, "警告"
Exit Sub
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim i, j As Integer
For i = 1999 To 2010
Combo6.AddItem i
Combo9.AddItem i
Next i
Combo6.ListIndex = 0
Combo9.ListIndex = 0
For i = 1 To 12
Combo7.AddItem i
Combo10.AddItem i
Next i
Combo7.ListIndex = 0
Combo10.ListIndex = 0
For i = 1 To 31
Combo8.AddItem i
Combo11.AddItem i
Next i
Combo8.ListIndex = 0
Combo11.ListIndex = 0
Combo1.AddItem ("专业")
Combo1.AddItem ("年级")
Combo1.AddItem ("课程名称")
Combo1.AddItem ("教材")
Combo1.AddItem ("任课老师")
'Combo1.AddItem ("课时")
Combo1.AddItem ("课程性质")
Combo1.AddItem ("考试性质")
Combo2.AddItem ("=")
Combo3.AddItem ("专业")
Combo3.AddItem ("年级")
Combo3.AddItem ("课程名称")
Combo3.AddItem ("教材")
Combo3.AddItem ("任课老师")
'Combo3.AddItem ("课时")
Combo3.AddItem ("课程性质")
Combo3.AddItem ("考试性质")
Combo4.AddItem ("=")
Combo5.AddItem ("学期")
Combo1.Text = ""
Combo2.Text = ""
Text1.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Text2.Text = ""
Combo5.Text = ""
Combo6.Text = ""
Combo7.Text = ""
Combo8.Text = ""
Combo9.Text = ""
Combo10.Text = ""
Combo11.Text = ""
End Sub
7.1.2 打印统计
运行打印统计后可以按条件把符合条件的各种信息以报表形式罗列出来,各种信息还可以以打印出来或以报表形式保存。打印统计包括班级统计分析、档案统计分析、课程统计分析、成绩统计分析和交费统计分析五类。
班级统计分析
代码如下:
Private Sub Command1_Click()
Dim SQLoriginal As String
Dim SQLadd As String
Dim SQLorder As String
Dim strSql As String
SQLoriginal = "SELECT 年级,专业,人数,辅导员,备注 FROM 班级表 "
SQLadd = "WHERE 年级=年级 AND 专业=专业 "
SQLorder = ""
If Check1.Value = 1 And IsNumeric(Text1) Then
SQLadd = SQLadd + "and 年级='" + Text1 + "'"
End If
If Check2.Value = 1 And Not IsNull(Text2) Then
SQLadd = SQLadd + "and 专业='" + Text2 + "'"
End If
If Check3.Value = 1 And IsNumeric(Text3) Then
SQLadd = SQLadd + "and 人数='" + Text3 + "'"
End If
If Check4.Value = 1 And Not IsNull(Text4) Then
SQLadd = SQLadd + "and 辅导员='" + Text4 + "'"
End If
strSql = SQLoriginal + SQLadd + SQLorde
If Dat_Main.rsDat_Class.State = 1 Then
Dat_Main.rsDat_Class.Close
End If
Dat_Main.rsDat_Class.Open strSql
Dat_Class.Show vbModal
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Text1_Change()
End Sub
Private Sub Text3_Change()
End Sub
档案分析统计
代码如下:
Private Sub Command1_Click()
Dim SQLoriginal As String
Dim SQLadd As String
Dim SQLorder As String
Dim strSql As String
On Error Resume Next
SQLoriginal = "SELECT * FROM 学生档案 "
SQLadd = "WHERE 学号=学号 AND 姓名=姓名 "
SQLorder = ""
If Check1.Value = 1 And IsNumeric(Text1) Then
SQLadd = SQLadd + "and 学号='" + Text1 + "'"
End If
If Check2.Value = 1 And Not IsNull(Text2) Then
SQLadd = SQLadd + "and 姓名='" + Text2 + "'"
End If
If Check3.Value = 1 And Not IsNull(Text3) Then
SQLadd = SQLadd + "and 专业='" + Text3 + "'"
End If
If Check4.Value = 1 And IsDate(DTPicker1) Then
SQLadd = SQLadd + " and 出生年月= # " & DTPicker1.Value & "#"
End If
strSql = SQLoriginal + SQLadd + SQLorde
If Dat_Main.rsDat_Strudent.State = 1 Then
Dat_Main.rsDat_Strudent.Close
End If
Dat_Main.rsDat_Strudent.Open strSql
Dat_Strudent.Show vbModal
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
'Combo1.AddItem ("男")
'Combo1.AddItem ("女")
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] 下一页