📄 frmdocfind.frm
字号:
VERSION 5.00
Begin VB.Form frmDocFind
Appearance = 0 'Flat
BorderStyle = 1 'Fixed Single
Caption = "档案查询"
ClientHeight = 2685
ClientLeft = 45
ClientTop = 330
ClientWidth = 3540
LinkTopic = "Form4"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2685
ScaleWidth = 3540
Begin VB.TextBox txtDocument
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 360
Index = 3
Left = 1200
TabIndex = 8
Top = 1560
Width = 2175
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 360
Index = 2
Left = 1200
TabIndex = 7
Top = 1080
Width = 2175
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 360
Index = 1
Left = 1200
TabIndex = 6
Top = 600
Width = 2175
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
Height = 375
Left = 1920
TabIndex = 5
Top = 2160
Width = 1095
End
Begin VB.CommandButton cmdOk
Caption = "确定"
Height = 375
Left = 600
TabIndex = 4
Top = 2160
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 360
Index = 0
Left = 1200
TabIndex = 0
Text = " "
Top = 135
Width = 2175
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "姓名关键字:"
ForeColor = &H00000000&
Height = 180
Left = 120
TabIndex = 9
Top = 1650
Width = 1080
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "学号:"
ForeColor = &H00000000&
Height = 180
Left = 660
TabIndex = 3
Top = 225
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "姓名:"
ForeColor = &H00000000&
Height = 180
Left = 660
TabIndex = 2
Top = 690
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "班级:"
ForeColor = &H00000000&
Height = 180
Left = 660
TabIndex = 1
Top = 1170
Width = 540
End
End
Attribute VB_Name = "frmDocFind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'----------------------------------frmDocFind.frm----------------------------------
Option Explicit
Private Sub cmdOK_Click()
Dim blnCondition As Boolean
Dim objRecordset As ADODB.Recordset
strSQL = ""
blnCondition = False
'判断是否输入了查询条件
If Trim(txtDocument(0).Text) <> "" Then
blnCondition = True
If strSQL = "" Then
strSQL = "Documents.学号='" & Trim(txtDocument(0).Text) & "'"
Else
strSQL = strSQL & "and Documents.学号='" & Trim(txtDocument(0).Text) & "'"
End If
End If
If Trim(txtDocument(1).Text) <> "" Then
blnCondition = True
If strSQL = "" Then
strSQL = "Documents.姓名='" & Trim(txtDocument(1).Text) & "'"
Else
strSQL = strSQL & "and Documents.姓名='" & Trim(txtDocument(1).Text) & "'"
End If
End If
If Trim(txtDocument(2).Text) <> "" Then
blnCondition = True
If strSQL = "" Then
strSQL = "Documents.班级='" & Trim(txtDocument(2).Text) & "'"
Else
strSQL = strSQL & "and Documents.班级='" & Trim(txtDocument(2).Text) & "'"
End If
End If
If Trim(txtDocument(3).Text) <> "" Then
blnCondition = True
strSQL = ""
strSQL = "Documents.姓名 like '%" & Trim(txtDocument(3).Text) & "%'"
End If
If blnCondition = False Then
MsgBox "你至少要输入一个条件以上才能查询!", , " 警告"
txtDocument(0).SetFocus
Exit Sub
End If
strSQL = "select * from Documents where " & strSQL
Set objRecordset = ExecuteSQL(Str)
'如果没有查询到
If objRecordset.EOF = True Then
MsgBox "对不起,没有此学生的档案记录!", vbOKOnly, "查询"
frmDocFind.ZOrder (0)
frmDocFind.txtDocument(0).SetFocus
Exit Sub
End If
'如果查询到,将数据显示在表格中
strSQL = "select Documents.学号,Documents.姓名,Documents.性别,Classes.年级,Documents.班级,Classes.专业,Classes.年制,Documents.出生年月,Documents.家庭住址,Documents.邮政编码,Documents.联系电话,Documents.入学时间,Documents.备注 from Documents inner join Classes on Documents.班级=Classes.班级 where " & strSQL & "order by Classes.年级 desc,Classes.班级 desc,Documents.学号 desc"
frmDocBrowse.printstr = strSQL
blnFindDoc = True
frmDocBrowse.Show
frmDocBrowse.ShowDocTitle
frmDocBrowse.ShowDocData
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub Form_Activate()
blnFindDoc = True
End Sub
Private Sub Form_LostFocus()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
blnFindDoc = False
End Sub
Private Sub txtDocument_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 + -