【VB开源代码栏目提醒】:网学会员为需要VB开源代码的朋友们搜集整理了E考核查询.frm相关资料,希望对各位网友有所帮助!
VERSION 5.00
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "msdatgrd.ocx"
Begin VB.Form E考核查询
Caption = "考核查询"
ClientHeight = 2835
ClientLeft = 60
ClientTop = 450
ClientWidth = 8805
LinkTopic = "Form1"
ScaleHeight = 2835
ScaleWidth = 8805
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton CmdExit
BackColor = &H00C0C0C0&
Caption = "退出"
Height = 360
Left = 7800
Style = 1 'Graphical
TabIndex = 5
Top = 360
Width = 800
End
Begin VB.Frame Frame1
Caption = "考核查询信息列表"
Height = 2655
Index = 0
Left = 120
TabIndex = 0
Top = 120
Width = 8655
Begin VB.CommandButton CmdQuery
BackColor = &H00C0C0C0&
Caption = "查询"
Height = 360
Left = 6720
Style = 1 'Graphical
TabIndex = 6
Top = 240
Width = 800
End
Begin VB.ComboBox CboQuery2
Height = 315
Left = 4200
Style = 2 'Dropdown List
TabIndex = 2
Top = 240
Width = 2055
End
Begin
VB.ComboBox CboQuery1
Height = 315
Left = 2040
Style = 2 'Dropdown List
TabIndex = 1
Top = 240
Width = 2055
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 1815
Left = 240
TabIndex = 3
Top = 720
Width = 8295
_ExtentX = 14631
_ExtentY = 3201
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "考核查询信息
列表"
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label8
Caption = "选择条件:"
Height = 255
Index = 0
Left = 1080
TabIndex = 4
Top = 240
Width = 1095
End
End
End
Attribute VB_Name = "E考核
查询"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs As ADODB.Recordset
Dim SQL As String
Dim msg As String
Dim Index As Integer
Private Sub Form_Load()
'初始化查询条件CmoboBox
CboQuery1.AddItem ("部门代码")
CboQuery1.AddItem ("员工ID")
CboQuery1.ListIndex = 0 '默认查询条件为部门代码
End Sub
Private Sub InitialComboBox(ByVal where As String)
'初始化CboQuery2
Set rs = SelectSQL(where, msg)
If rs.RecordCount = 0 Then
MsgBox ("请先建立相关信息!")
Exit Sub
Else
Do While Not rs.BOF And Not rs.EOF
'添加到ComboBox列表
Me.CboQuery2.AddItem (rs.Fields(0) & rs.Fields(1))
rs.MoveNext '指向下一条记录
Loop
Me.CboQuery2.ListIndex = 0 '默认ComboBox
rs.Close
End If
End Sub
Private Sub CmdQuery_Click()
'查询操作
Dim rst As ADODB.Recordset
Dim CboName As String
If CboQuery1.Text = "部门代码" Then '如果选择的是部门代码
CboName = Left(Trim(CboQuery2.Text), 4) '保存部门的名称
SQL = " select * from 工作考核信息表 a INNER JOIN 员工录用信息表 b "
SQL = SQL & "ON a.员工ID=b.员工ID INNER JOIN 部门信息表 c "
SQL = SQL & "ON b.受聘部门 = c.部门名称 "
SQL = SQL & "where a.员工ID like '" & CboName & "%' ORDER BY 工作考核ID"
Set rst = SelectSQL(SQL, msg)
If rst.RecordCount <> 0 Then
Set DataGrid1.DataSource = rst '给DataGrid的数据源赋值
End If
Else '如果选择的是员工ID
CboName = Left(Trim(CboQuery2.Text), 8) '保存员工的ID
SQL = " select * from 工作考核信息表 where "
SQL = SQL & "员工ID='" & CboName & "' ORDER BY
工作考核ID"
Set rst = SelectSQL(SQL, msg)
If rst.RecordCount <> 0 Then
Set DataGrid1.DataSource = rst '给DataGrid的数据源赋值
End If
End If
End Sub
Private Sub CboQuery1_click()
'改变查询条件时,CboQuery2中的值也随之改变
CboQuery2.Clear '清空ComboBox
Select Case CboQuery1.ListIndex
Case 0: '如果查询条件是“部门代码”
'初始化已考核的员工的部门
SQL = "SELECT DISTINCT c.部门代码, c.部门名称 FROM 员工录用信息表 a INNER JOIN "
SQL = SQL & "工作考核信息表 b ON a.员工ID = b.员工ID INNER JOIN 部门信息表 c "