📄 frmstuinfoquery.frm
字号:
VERSION 5.00
Object = "{CE671F01-259E-40DA-92FE-95803E2ECBB5}#1.0#0"; "SmartXPButton.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form FrmStuInfoQuery
BackColor = &H00E7DFE7&
BorderStyle = 1 'Fixed Single
Caption = "员工信息查询"
ClientHeight = 6120
ClientLeft = 45
ClientTop = 330
ClientWidth = 10575
Icon = "FrmStuInfoQuery.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 6120
ScaleWidth = 10575
Begin VB.Frame Frame1
BackColor = &H00E7DFE7&
Caption = "查询条件"
Height = 2775
Left = 120
TabIndex = 11
Top = 3120
Width = 10335
Begin VB.TextBox txtStudentId
Height = 315
Left = 1080
MaxLength = 12
TabIndex = 3
Top = 1440
Width = 1335
End
Begin VB.ComboBox cbodepart
Height = 300
Left = 6840
TabIndex = 2
Top = 2040
Width = 1320
End
Begin VB.TextBox txtstudentName
Height = 315
Left = 1080
MaxLength = 8
TabIndex = 0
Top = 840
Width = 1260
End
Begin VB.ComboBox cboSex
Height = 300
Left = 3900
Style = 2 'Dropdown List
TabIndex = 1
Top = 840
Width = 735
End
Begin VB.TextBox txtTel
Height = 315
Left = 1080
MaxLength = 20
TabIndex = 5
Top = 2070
Width = 1290
End
Begin MSMask.MaskEdBox txtInDate
Height = 315
Left = 3900
TabIndex = 6
Top = 2040
Width = 1335
_ExtentX = 2355
_ExtentY = 556
_Version = 393216
MaxLength = 10
Mask = "####-##-##"
PromptChar = "_"
End
Begin MSMask.MaskEdBox txtBirth
Height = 315
Left = 3900
TabIndex = 4
Top = 1440
Width = 1335
_ExtentX = 2355
_ExtentY = 556
_Version = 393216
MaxLength = 10
Mask = "####-##-##"
PromptChar = "_"
End
Begin SmartXPButton.XpButton CmdQuery
Height = 495
Left = 8640
TabIndex = 8
Top = 600
Width = 1335
_ExtentX = 2355
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "查找(&F)"
CaptionMouseOverColor= 16711680
PictureBackColor= 15790320
PictureSmoothBackColor= 15790320
ButtonPicture = "FrmStuInfoQuery.frx":2CFA
End
Begin SmartXPButton.XpButton cmdExit
Cancel = -1 'True
Height = 495
Left = 8640
TabIndex = 9
Top = 1680
Width = 1335
_ExtentX = 2355
_ExtentY = 873
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "关闭(&E)"
CaptionMouseOverColor= 16711680
PictureBackColor= 15790320
PictureSmoothBackColor= 15790320
ButtonPicture = "FrmStuInfoQuery.frx":50DC
End
Begin MSComctlLib.Toolbar Toolbar1
Height = 840
Left = 7080
TabIndex = 7
Top = 600
Width = 795
_ExtentX = 1402
_ExtentY = 1482
ButtonWidth = 1032
ButtonHeight = 1376
Appearance = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 1
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "打印"
ImageKey = "print"
Style = 5
BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628}
NumButtonMenus = 2
BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "Current"
Text = "打印当前记录"
EndProperty
BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "All"
Text = "打印全部记录"
EndProperty
EndProperty
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 5400
Top = 360
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "FrmStuInfoQuery.frx":59B6
Key = "print"
EndProperty
EndProperty
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "出生日期:"
Height = 180
Left = 2640
TabIndex = 18
Top = 1515
Width = 900
End
Begin VB.Label Label7
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "就职时间:"
Height = 180
Left = 2640
TabIndex = 17
Top = 2130
Width = 900
End
Begin VB.Label Label6
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "电话:"
Height = 180
Left = 240
TabIndex = 16
Top = 2130
Width = 540
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "部门:"
Height = 180
Left = 5880
TabIndex = 15
Top = 2160
Width = 540
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "性别:"
Height = 180
Left = 3000
TabIndex = 14
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 = 13
Top = 900
Width = 540
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "员工号:"
Height = 180
Left = 60
TabIndex = 12
Top = 1515
Width = 720
End
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid StudentGrid
Height = 2775
Left = 120
TabIndex = 10
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
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub CmdQuery_Click()
On Error Resume Next
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_sex,birth_date,depart,tele_number,in_date,address,comment from student_info 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_sex='" & 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 cbodepart.Text <> "" Then
sql7 = "and depart='" & cbodepart.Text & "'"
Else
sql7 = " "
End If
sql = sql & sql1 & sql2 & sql3 & sql4 & sql5 & sql6 & sql7
StuQuery.rsDK1 sql
If StuQuery.rs1.EOF Then
StudentGrid.Clear
StudentGrid.FormatString = " | 员工号| 姓 名|性别| 出生日期| 部门| 联系电话| 就职时间| 家庭住址| 注释"
MsgBox "没有找到符合条件的记录!", vbOKOnly + vbInformation, "提示"
Else
StuQuery.rsDK1 sql
Set StudentGrid.DataSource = StuQuery.rs1
StudentGrid.FormatString = " | 员工号| 姓 名|性别| 出生日期| 部门| 联系电话| 就职时间| 家庭住址| 注释"
End If
End Sub
Private Sub Form_Load()
On Error Resume Next
Set StuQuery = New OpenRs
StuQuery.rsDK1 "select student_id,student_name,student_sex,birth_date,depart,tele_number,in_date,address,comment from student_info where 1=1 "
StudentGrid.Clear
Set StudentGrid.DataSource = StuQuery.rs1
StudentGrid.FormatString = " | 员工号| 姓 名|性别| 出生日期| 部门| 联系电话| 就职时间| 家庭住址| 注释"
cboSex.AddItem "男"
cboSex.AddItem "女"
cboSex.AddItem ""
StuQuery.rsDK1 "select distinct depart from student_info"
While Not StuQuery.rs1.EOF
cbodepart.AddItem (StuQuery.rs1!depart)
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 + -