📄 frmempinfo.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmEmpInfo
BorderStyle = 3 'Fixed Dialog
Caption = "员工信息浏览"
ClientHeight = 6825
ClientLeft = 45
ClientTop = 330
ClientWidth = 9510
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6825
ScaleWidth = 9510
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton cmdReturn
Caption = "返 回"
Height = 375
Left = 7200
TabIndex = 1
Top = 5760
Width = 975
End
Begin VB.CommandButton cmdDel
Caption = "删 除"
Height = 375
Left = 4200
TabIndex = 0
Top = 5760
Width = 975
End
Begin MSFlexGridLib.MSFlexGrid flxShow
Height = 4095
Left = 600
TabIndex = 2
Top = 480
Width = 8295
_ExtentX = 14631
_ExtentY = 7223
_Version = 393216
End
Begin VB.Label Label1
Caption = "请选择上述一条记录操作:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 3
Top = 4920
Width = 4095
End
End
Attribute VB_Name = "frmEmpInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs As New ADODB.Recordset
Dim strSql As String
Private Sub cmdDel_Click()
Dim intDel As Integer
intDel = MsgBox("确定要删除此条资料?", 1, "删除")
If intDel = 1 Then
tEmp_id = flxShow.TextMatrix(flxShow.Row, 0)
' 删除工号为选中的员工资料
strSql = "Delete from employee checkin where emp_id =clng ('" & tEmp_id & " ') "
dbConn.Execute strSql
tEmp_id = flxShow.TextMatrix(flxShow.Row, 0)
' 删除工号为选中的考勤资料
strSql = "Delete from checkin where emp_id =clng ('" & tEmp_id & " ') "
dbConn.Execute strSql
refreshGird
End If
End Sub
Private Sub cmdReturn_Click()
Unload Me
End Sub
Private Sub Form_Activate()
refreshGird
End Sub
Private Sub Form_Load()
Me.Icon = LoadPicture(App.Path & "\Graph07.ico")
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set rs = Nothing
End Sub
Private Sub refreshGird()
Dim i As Integer
'打开一个数据集
strSql = "select a.emp_id,a.emp_name,a.sex,b.edu_name,c.dept_name,d.duty_name,e.title_name from employee a,education b,department c,duty d,title e where a.edu_id=b.edu_id and a.dept_id=c.dept_id and a.duty_id=d.duty_id and a.title_id=e.title_id order by a.emp_id"
rs.Open strSql, dbConn, adOpenForwardOnly, adLockReadOnly
If rs.EOF Then
MsgBox "目前已没有员工资料!", vbOKOnly + vbExclamation, "警告"
rs.Close
cmdDel.Enabled = False
Unload Me
Exit Sub
End If
'设置列数
flxShow.Cols = 8
'列标题
flxShow.TextMatrix(0, 0) = "工号"
flxShow.TextMatrix(0, 1) = ""
flxShow.TextMatrix(0, 2) = "姓名"
flxShow.TextMatrix(0, 3) = "性别"
flxShow.TextMatrix(0, 4) = "学历"
flxShow.TextMatrix(0, 5) = "部门"
flxShow.TextMatrix(0, 6) = "职务"
flxShow.TextMatrix(0, 7) = "职称"
'设置列宽
flxShow.ColWidth(0) = 600
flxShow.ColWidth(1) = 0
flxShow.ColWidth(2) = 1200
flxShow.ColWidth(3) = 800
flxShow.ColWidth(4) = 1400
flxShow.ColWidth(5) = 1400
flxShow.ColWidth(6) = 1400
flxShow.ColWidth(7) = 1410
'设置各列的对齐方式
For i = 0 To 7
flxShow.ColAlignment(i) = 0
Next i
'表头项居中
flxShow.FillStyle = flexFillRepeat
flxShow.Col = 0
flxShow.Row = 0
flxShow.RowSel = 1
flxShow.ColSel = flxShow.Cols - 1
flxShow.CellAlignment = 4
'填写数据
flxShow.Rows = 1
Do While Not rs.EOF
flxShow.Rows = flxShow.Rows + 1
flxShow.TextMatrix(flxShow.Rows - 1, 0) = rs.Fields(0).Value
For i = 2 To rs.Fields.Count
flxShow.TextMatrix(flxShow.Rows - 1, i) = rs.Fields(i - 1).Value
Next i
rs.MoveNext
Loop
rs.Close
'强制跨越整个行选择
flxShow.SelectionMode = flexSelectionByRow
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -