📄 form4.frm
字号:
VERSION 5.00
Begin VB.Form Form4
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "查询"
ClientHeight = 4845
ClientLeft = 4935
ClientTop = 5340
ClientWidth = 10185
LinkTopic = "Form4"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4845
ScaleWidth = 10185
Begin VB.TextBox Text1
BackColor = &H80000018&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 360
Index = 2
Left = 4680
TabIndex = 5
Top = 2640
Width = 2295
End
Begin VB.TextBox Text1
BackColor = &H80000018&
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Index = 1
Left = 4680
TabIndex = 4
Top = 1800
Width = 2295
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 5760
TabIndex = 3
Top = 3720
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 2880
TabIndex = 2
Top = 3720
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H80000018&
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 345
Index = 0
Left = 4680
TabIndex = 0
Text = " "
Top = 960
Width = 2295
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "班级:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Left = 2520
TabIndex = 8
Top = 2640
Width = 1575
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "姓名:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 375
Left = 2520
TabIndex = 7
Top = 1920
Width = 1455
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "学号:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 495
Left = 2520
TabIndex = 6
Top = 960
Width = 1215
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "学生档案查询"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Left = 3720
TabIndex = 1
Top = 120
Width = 2175
End
End
Attribute VB_Name = "Form4"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim aa As Integer
txtsql = ""
If Trim(Text1(0).Text) <> "" Then
aa = 1
If txtsql = "" Then
txtsql = "xj.学号='" & Trim(Text1(0).Text) & "'"
Else
txtsql = txtsql & "and xj.学号='" & Trim(Text1(0).Text) & "'"
End If
End If
If Trim(Text1(1).Text) <> "" Then
aa = 1
If txtsql = "" Then
txtsql = "xj.姓名='" & Trim(Text1(1).Text) & "'"
Else
txtsql = txtsql & "and xj.姓名='" & Trim(Text1(1).Text) & "'"
End If
End If
If Trim(Text1(2).Text) <> "" Then
aa = 1
If txtsql = "" Then
txtsql = "xj.班级='" & Trim(Text1(2).Text) & "'"
Else
txtsql = txtsql & "and xj.班级='" & Trim(Text1(2).Text) & "'"
End If
End If
If aa = 0 Then
ss = MsgBox("你至少要输入一个条件以上才能查询!", , " 警告")
Text1(0).SetFocus
Exit Sub
End If
Dim str As String
str = "select * from xj where " & txtsql
Dim mrc As ADODB.Recordset
Set mrc = ExecuteSQL(str)
If mrc.EOF = True Then
zzz = MsgBox("对不起,没有此学生的档案记录!", vbOKOnly, "查询")
Form4.ZOrder (0)
Form4.Text1(0).SetFocus
Exit Sub
End If
txtsql = "select xj.学号,xj.姓名,xj.性别,class.年级,xj.班级,class.专业,class.年制,xj.出生年月,xj.家庭住址,xj.邮政编码,xj.联系电话,xj.入学时间,xj.备注 from xj inner join class on xj.班级=class.班级 where " & txtsql & "order by class.年级 desc,class.班级 desc,xj.学号 desc"
Form3.printstr = txtsql
find = True
Form3.Show
'select xj.学号,xj.姓名,xj.性别,class.年级,xj.班级,class.专业,class.年制,xj.出生年月,xj.家庭住址,xj.邮政编码,xj.联系电话,xj.入学时间,xj.备注 from xj inner join class on xj.班级=class.班级 where xj.班级='01美术一' or 年级='01美术一' order by class.年级 desc,class.班级 desc,xj.学号 desc
Form3.Caption = "学生档案查询结果"
Form3.showtitle
Form3.showdata
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
find = True
End Sub
Private Sub Form_LostFocus()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
find = False
'Form3.Caption = "浏览学生档案"
End Sub
Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 39 Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -