frmLookMan.frm
资源名称:考勤6.rar [点击查看]
上传用户:djzm888
上传日期:2013-02-15
资源大小:867k
文件大小:7k
源码类别:
其他数据库
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
- Begin VB.Form frmLookMan
- BorderStyle = 3 'Fixed Dialog
- Caption = "查找员工"
- ClientHeight = 3765
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 5940
- BeginProperty Font
- Name = "宋体"
- Size = 10.5
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Icon = "frmLookMan.frx":0000
- LinkTopic = "Form1"
- LockControls = -1 'True
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 3765
- ScaleWidth = 5940
- ShowInTaskbar = 0 'False
- StartUpPosition = 2 '屏幕中心
- Begin MSFlexGridLib.MSFlexGrid msfGrid
- Height = 2460
- Left = 120
- TabIndex = 6
- Top = 630
- Width = 5680
- _ExtentX = 10028
- _ExtentY = 4339
- _Version = 393216
- FixedCols = 0
- End
- Begin VB.CommandButton Command1
- Caption = "返回(&R)"
- Height = 420
- Index = 1
- Left = 4500
- TabIndex = 5
- Top = 3225
- Width = 1260
- End
- Begin VB.CommandButton Command1
- Caption = "确定(&K)"
- Enabled = 0 'False
- Height = 420
- Index = 0
- Left = 2985
- TabIndex = 4
- Top = 3225
- Width = 1260
- End
- Begin VB.CheckBox chkEdit
- Caption = "按模糊查找"
- Height = 315
- Left = 300
- TabIndex = 3
- Top = 3255
- Width = 1500
- End
- Begin VB.TextBox txtEdit
- Height = 345
- Left = 1170
- TabIndex = 1
- Top = 180
- Width = 2235
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "(可输入拼音编号中文)"
- Height = 210
- Index = 1
- Left = 3525
- TabIndex = 2
- Top = 240
- Width = 2310
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- Caption = "员工姓名:"
- Height = 210
- Index = 0
- Left = 180
- TabIndex = 0
- Top = 240
- Width = 945
- End
- End
- Attribute VB_Name = "frmLookMan"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- 'public
- Public mWorkNo As String
- Public mName As String
- Public mSex As String
- Public mAge As String
- Public mDept As String
- Public mTitle As String
- Private Sub Command1_Click(Index As Integer)
- With msfGrid
- If Index = 0 Then
- If .Rows = .FixedRows Then Exit Sub
- mWorkNo = Trim(.TextMatrix(.row, 0))
- mName = Trim(.TextMatrix(.row, 1))
- mSex = Trim(.TextMatrix(.row, 2))
- mAge = Trim(.TextMatrix(.row, 3))
- mDept = Trim(.TextMatrix(.row, 4))
- mTitle = Trim(.TextMatrix(.row, 5))
- Else
- mWorkNo = Empty
- mName = Empty
- mSex = Empty
- mAge = Empty
- mDept = Empty
- mTitle = Empty
- End If
- End With
- Me.Hide
- End Sub
- Private Sub Form_Load()
- SetGridColor msfGrid
- With msfGrid
- .FormatString = "^工号" & Space(4) & vbTab & _
- "<姓名" & Space(6) & vbTab & _
- "^性别" & Space(2) & vbTab & _
- "^年龄" & Space(2) & vbTab & _
- "<部门" & Space(5) & vbTab & _
- "<职务" & Space(5)
- End With
- End Sub
- Private Sub msfGrid_DblClick()
- Command1_Click 0
- End Sub
- Private Sub msfGrid_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = 13 Then Command1_Click 0
- End Sub
- Private Sub txtEdit_GotFocus()
- GotFocus txtEdit
- End Sub
- Private Sub txtEdit_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = 13 Then
- Dim tmpStr As String
- Dim FindStr As String
- Dim FindLen As Integer
- Dim WhereStr As String
- FindStr = Trim(txtEdit)
- FindLen = Len(FindStr)
- tmpStr = Left(FindStr, 1)
- If IsNumeric(tmpStr) Then 'number
- If chkEdit.Value = 1 Then
- WhereStr = " instr(1,WorkNo,'" & FindStr & "',1)>0 "
- Else
- WhereStr = "left(WorkNo," & FindLen & ")='" & FindStr & "'"
- End If
- ElseIf AscB(RightB(tmpStr, 1)) = 0 Then 'char
- If chkEdit.Value = 1 Then
- WhereStr = " instr(1,Spell,'" & FindStr & "',1)>0 "
- Else
- WhereStr = "left(Spell," & FindLen & ")='" & FindStr & "'"
- End If
- Else 'chinese
- If chkEdit.Value = 1 Then
- WhereStr = " instr(1,Name,'" & FindStr & "',1)>0 "
- Else
- WhereStr = "left(Name," & LenB(FindStr) & ")='" & FindStr & "'"
- End If
- End If
- Dim Rst As Recordset
- Dim ClipStr As String
- Dim RowCount As Integer
- Dim I As Integer
- Set Rst = gDataBase.OpenRecordset("select * from QryEmployee " _
- & " Where " & WhereStr & " order by WorkNo", dbOpenSnapshot)
- Do While Not Rst.EOF
- With Rst
- I = I + 1
- RowCount = .RecordCount
- ClipStr = ClipStr & IIf(IsNull(!WorkNo), "", Trim(!WorkNo)) & vbTab _
- & IIf(IsNull(!Name), "", Trim(!Name)) & vbTab _
- & IIf(IsNull(!Sex), "", Trim(!Sex)) & vbTab _
- & IIf(IsNull(!Age), "", Trim(Str(!Age))) & vbTab _
- & IIf(IsNull(!DeptName), "", Trim(!DeptName)) & vbTab _
- & IIf(IsNull(!TitleName), "", Trim(!TitleName))
- If I <> RowCount Then
- ClipStr = ClipStr & vbCr
- End If
- .MoveNext
- End With
- Loop
- Rst.Close
- Set Rst = Nothing
- With msfGrid
- .Rows = .FixedRows
- If .Redraw Then .Redraw = False
- .Rows = RowCount + .FixedRows
- .Cols = 6
- If .Rows > .FixedRows Then
- .row = .FixedRows
- .col = 0
- .RowSel = .Rows - 1
- .ColSel = .Cols - 1
- .Clip = ClipStr
- .row = .FixedRows
- .col = 0
- .SetFocus
- Else
- txtEdit.SetFocus
- End If
- If Not .Redraw Then .Redraw = True
- End With
- End If
- Command1(0).Enabled = (msfGrid.Rows > msfGrid.FixedRows)
- End Sub