📄 frmstuinfoquery.frm
字号:
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "性别:"
Height = 180
Left = 3000
TabIndex = 17
Top = 900
Width = 540
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名:"
Height = 180
Left = 240
TabIndex = 16
Top = 900
Width = 540
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "学号:"
Height = 180
Left = 240
TabIndex = 15
Top = 1515
Width = 540
End
Begin VB.Label Label8
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "班主任编号:"
Height = 180
Left = 5610
TabIndex = 14
Top = 2130
Width = 1080
End
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid StudentGrid
Height = 2775
Left = 120
TabIndex = 12
Top = 120
Width = 10335
_ExtentX = 18230
_ExtentY = 4895
_Version = 393216
BackColorFixed = 15196135
BackColorBkg = 15196135
BackColorUnpopulated= 15196135
_NumberOfBands = 1
_Band(0).Cols = 2
End
End
Attribute VB_Name = "FrmStuInfoQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim StuQuery As OpenRs
Dim sql As String
Dim sql1 As String
Dim sql2 As String
Dim sql3 As String
Dim sql4 As String
Dim sql5 As String
Dim sql6 As String
Dim sql7 As String
Dim sql8 As String
Dim sql9 As String
Private Sub cboClassno_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If Not ((Chr(KeyAscii) <= "Z" And Chr(KeyAscii) >= "A") Or (Chr(KeyAscii) <= "9" And Chr(KeyAscii) >= "0") Or KeyAscii = 8) Then
KeyAscii = 0
End If
End Sub
Private Sub cboGradeno_KeyPress(KeyAscii As Integer)
If Not ((UCase(Chr(KeyAscii)) <= "Z" And UCase(Chr(KeyAscii)) >= "A") Or (Chr(KeyAscii) <= "9" And Chr(KeyAscii) >= "0") Or KeyAscii = 8) Then
KeyAscii = 0
End If
End Sub
Private Sub cboUserid_KeyPress(KeyAscii As Integer)
If Not ((UCase(Chr(KeyAscii)) <= "Z" And UCase(Chr(KeyAscii)) >= "A") Or (Chr(KeyAscii) <= "9" And Chr(KeyAscii) >= "0") Or KeyAscii = 8) Then
KeyAscii = 0
End If
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub CmdQuery_Click()
If Val(txtBirth.Text) <> 0 Then
If Not IsDate(txtBirth.Text) Then
MsgBox "出生日期不是有效日期,请重新输入!", vbInformation, "提示"
txtBirth.SetFocus
txtBirth.Text = "____-__-__"
Exit Sub
End If
End If
If Val(txtInDate.Text) <> 0 Then
If Not IsDate(txtInDate.Text) Then
MsgBox "入校时间不是有效日期,请重新输入!", vbInformation, "提示"
txtInDate.SetFocus
txtInDate.Text = "____-__-__"
Exit Sub
End If
End If
sql = "select student_id,student_name,student_gender,birth_date,s.class_no,tele_number,in_date,grade_no,user_id,address,comment from student_info s inner join class_info c on s.class_no=c.class_no where 1=1"
If txtstudentName.Text <> "" Then
sql1 = "and student_name='" & txtstudentName.Text & "'"
Else
sql1 = " "
End If
If txtStudentId.Text <> "" Then
sql2 = "and student_id='" & txtStudentId.Text & "'"
Else
sql2 = " "
End If
If txtTel.Text <> "" Then
sql3 = "and tele_number='" & txtTel.Text & "'"
Else
sql3 = " "
End If
If cboSex.Text <> "" Then
sql4 = "and student_gender='" & cboSex.Text & "'"
Else
sql4 = " "
End If
If Val(txtBirth.Text) <> 0 Then
sql5 = "and birth_date='" & txtBirth.Text & "'"
Else
sql5 = " "
End If
If Val(txtInDate.Text) <> 0 Then
sql6 = "and in_date='" & txtInDate.Text & "'"
Else
sql6 = " "
End If
If cboClassNo.Text <> "" Then
sql7 = "and s.class_no='" & cboClassNo.Text & "'"
Else
sql7 = " "
End If
If cboGradeNo.Text <> "" Then
sql8 = "and grade_no='" & cboGradeNo.Text & "'"
Else
sql8 = " "
End If
If cboUserId.Text <> "" Then
sql9 = "and user_id='" & cboUserId.Text & "'"
Else
sql9 = " "
End If
sql = sql & sql1 & sql2 & sql3 & sql4 & sql5 & sql6 & sql7 & sql8 & sql9
StuQuery.rsDK1 sql
If StuQuery.rs1.EOF Then
StudentGrid.Clear
StudentGrid.FormatString = " | 学 号| 姓 名|性别| 出生日期|班号| 联系电话| 入校时间| 年级编号|班主任编号| 家庭住址| 注释"
MsgBox "没有找到符合条件的记录!", vbOKOnly + vbInformation, "提示"
Else
Set StudentGrid.DataSource = StuQuery.rs1
StudentGrid.FormatString = " | 学 号| 姓 名|性别| 出生日期|班号| 联系电话| 入校时间| 年级编号|班主任编号| 家庭住址| 注释"
End If
End Sub
Private Sub Form_Load()
Set StuQuery = New OpenRs
StudentGrid.FormatString = " | 学 号| 姓 名|性别| 出生日期|班号| 联系电话| 入校时间| 年级编号|班主任编号| 家庭住址| 注释"
StuQuery.rsDK1 "select student_id,student_name,student_gender,birth_date,s.class_no,tele_number,in_date,grade_no,user_id,address,comment from student_info s inner join class_info c on s.class_no=c.class_no"
If StuQuery.rs1.EOF Then
StudentGrid.Clear
StudentGrid.FormatString = " | 学 号| 姓 名|性别| 出生日期|班号| 联系电话| 入校时间| 年级编号|班主任编号| 家庭住址| 注释"
Else
Set StudentGrid.DataSource = StuQuery.rs1
StudentGrid.FormatString = " | 学 号| 姓 名|性别| 出生日期|班号| 联系电话| 入校时间| 年级编号|班主任编号| 家庭住址| 注释"
End If
cboSex.AddItem "男"
cboSex.AddItem "女"
cboSex.AddItem ""
StuQuery.rsDK1 "select class_no from class_info"
While Not StuQuery.rs1.EOF
cboClassNo.AddItem (StuQuery.rs1!Class_no)
StuQuery.rs1.MoveNext
Wend
StuQuery.rsDK1 "select distinct grade_no from class_info"
While Not StuQuery.rs1.EOF
cboGradeNo.AddItem (StuQuery.rs1!grade_no)
StuQuery.rs1.MoveNext
Wend
StuQuery.rsDK1 "select distinct user_id from class_info"
While Not StuQuery.rs1.EOF
cboUserId.AddItem (StuQuery.rs1!user_id)
StuQuery.rs1.MoveNext
Wend
End Sub
Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
Select Case ButtonMenu.Key
Case "Current"
Call CmdQuery_Click
If Not StuQuery.rs1.EOF Then
StudentReport.Show
Set StudentReport.DataSource = StuQuery.rs1
End If
Case "All"
StuQuery.rsDK1 "select * from student_info"
Set StudentReport.DataSource = StuQuery.rs1
StudentReport.Show
End Select
End Sub
Private Sub txtBirth_KeyPress(KeyAscii As Integer)
If Not (Chr(KeyAscii) <= "9" And Chr(KeyAscii) >= "0" Or KeyAscii = 45 Or KeyAscii = 8) Then
KeyAscii = 0
End If
End Sub
Private Sub txtInDate_KeyPress(KeyAscii As Integer)
If Not (Chr(KeyAscii) <= "9" And Chr(KeyAscii) >= "0" Or KeyAscii = 45 Or KeyAscii = 8) Then
KeyAscii = 0
End If
End Sub
Private Sub txtStudentId_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
If Not ((Chr(KeyAscii) <= "Z" And Chr(KeyAscii) >= "A") Or (Chr(KeyAscii) <= "9" And Chr(KeyAscii) >= "0") Or KeyAscii = 8) Then
KeyAscii = 0
End If
End Sub
Private Sub txtstudentName_KeyPress(KeyAscii As Integer)
If KeyAscii = 39 Then KeyAscii = 0
End Sub
Private Sub txtTel_KeyPress(KeyAscii As Integer)
If Not (Chr(KeyAscii) <= "9" And Chr(KeyAscii) >= "0" Or KeyAscii = 45 Or KeyAscii = 8) Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -