📄 frmmanapp1.frm
字号:
VERSION 5.00
Begin VB.Form frmManApp1
BorderStyle = 3 'Fixed Dialog
Caption = "员工评价"
ClientHeight = 5640
ClientLeft = 48
ClientTop = 336
ClientWidth = 9504
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5640
ScaleWidth = 9504
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Begin VB.TextBox txtItem
Height = 270
Index = 0
Left = 840
TabIndex = 24
TabStop = 0 'False
Top = 5280
Visible = 0 'False
Width = 1335
End
Begin VB.TextBox txtItem
Height = 270
Index = 1
Left = 2880
TabIndex = 23
TabStop = 0 'False
Top = 5280
Visible = 0 'False
Width = 1455
End
Begin VB.Frame Frame3
Caption = "其它信息"
Height = 3735
Left = 4800
TabIndex = 19
Top = 1320
Width = 4455
Begin VB.TextBox txtItem
Height = 975
Index = 6
Left = 1200
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 6
Top = 360
Width = 3015
End
Begin VB.TextBox txtItem
Height = 975
Index = 7
Left = 1200
MaxLength = 40
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 7
Top = 1440
Width = 3015
End
Begin VB.TextBox txtItem
Height = 975
Index = 8
Left = 1200
MaxLength = 40
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 8
Top = 2520
Width = 3015
End
Begin VB.Label Label2
Caption = "备 注:"
Height = 255
Index = 3
Left = 240
TabIndex = 22
Top = 360
Width = 975
End
Begin VB.Label Label2
Caption = "其 它1:"
Height = 255
Index = 4
Left = 240
TabIndex = 21
Top = 1440
Width = 975
End
Begin VB.Label Label2
Caption = "其 它2:"
Height = 255
Index = 5
Left = 240
TabIndex = 20
Top = 2520
Width = 1335
End
End
Begin VB.Frame Frame2
Caption = "工作评价"
Height = 3735
Left = 240
TabIndex = 15
Top = 1320
Width = 4335
Begin VB.TextBox txtItem
Height = 975
Index = 3
Left = 1080
MaxLength = 40
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Top = 360
Width = 3015
End
Begin VB.TextBox txtItem
Height = 975
Index = 4
Left = 1080
MaxLength = 40
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 4
Top = 1440
Width = 3015
End
Begin VB.TextBox txtItem
Height = 975
Index = 5
Left = 1080
MaxLength = 40
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 5
Top = 2520
Width = 3015
End
Begin VB.Label Label2
Caption = "工作业绩:"
Height = 255
Index = 2
Left = 120
TabIndex = 18
Top = 360
Width = 975
End
Begin VB.Label Label2
Caption = "工作态度:"
Height = 255
Index = 12
Left = 120
TabIndex = 17
Top = 1440
Width = 975
End
Begin VB.Label Label2
Caption = "业务水平"
Height = 255
Index = 13
Left = 120
TabIndex = 16
Top = 2520
Width = 975
End
End
Begin VB.Frame Frame1
Caption = "员工信息"
Height = 855
Left = 240
TabIndex = 11
Top = 240
Width = 9015
Begin VB.ComboBox cboItem
Height = 300
Index = 1
Left = 4200
Style = 2 'Dropdown List
TabIndex = 1
Top = 360
Width = 1815
End
Begin VB.ComboBox cboItem
Height = 300
Index = 0
Left = 1200
Style = 2 'Dropdown List
TabIndex = 0
Top = 360
Width = 1815
End
Begin VB.TextBox txtItem
Height = 270
Index = 2
Left = 7200
MaxLength = 10
TabIndex = 2
Top = 360
Width = 1575
End
Begin VB.Label Label2
Caption = "时 间:"
Height = 255
Index = 16
Left = 6240
TabIndex = 14
Top = 360
Width = 975
End
Begin VB.Label Label2
Caption = "姓 名:"
Height = 255
Index = 1
Left = 3240
TabIndex = 13
Top = 360
Width = 975
End
Begin VB.Label Label2
Caption = "部 门:"
Height = 255
Index = 0
Left = 240
TabIndex = 12
Top = 360
Width = 975
End
End
Begin VB.CommandButton cmdExit
Caption = "返回 (&X)"
Height = 375
Left = 7920
TabIndex = 10
Top = 5160
Width = 1215
End
Begin VB.CommandButton cmdSave
Caption = "保存 (&S)"
Height = 375
Left = 6360
TabIndex = 9
Top = 5160
Width = 1215
End
End
Attribute VB_Name = "frmManApp1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'是否改动过记录,ture为改过
Dim mblChange As Boolean
Dim mrc As ADODB.Recordset
Public txtSQL As String
Dim MsgText As String
'操作的表名称
Private Sub cboItem_Click(Index As Integer)
Dim sSql As String
If gintMode = 1 Then
'初始化员工名称和ID
If Index = 0 Then
cboItem(1).Clear
txtSQL = "select ygid,ygname from manrecord where ygdept='" & Trim(cboItem(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If Not mrc.EOF Then
With cboItem(1)
Do While Not mrc.EOF
.AddItem Trim(mrc!ygname)
mrc.MoveNext
Loop
.ListIndex = 0
End With
cmdSave.Enabled = True
Else
MsgBox "请先建立员工档案!", vbOKOnly + vbExclamation, "警告"
cmdSave.Enabled = False
Exit Sub
End If
ElseIf Index = 1 Then
mrc.MoveFirst
mrc.Move cboItem(1).ListIndex
txtItem(1) = Trim(mrc!ygid)
End If
End If
End Sub
Private Sub cboItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
Private Sub cmdExit_Click()
If mblChange And cmdSave.Enabled Then
If MsgBox("保存当前记录的变化吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
'保存
Call cmdSave_Click
End If
End If
Unload Me
End Sub
Private Sub cmdSave_Click()
Dim intCount As Integer
Dim sMeg As String
Dim sSql As String
If Trim(txtItem(2) & " ") = "" Then
sMeg = "时间"
sMeg = sMeg & "不能为空!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
txtItem(2).SetFocus
Exit Sub
End If
If Trim(txtItem(2) & " ") <> "" Then
If Not IsDate(txtItem(2)) Then
MsgBox "时间应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
txtItem(2).SetFocus
Exit Sub
Else
txtItem(2) = Format(txtItem(2), "yyyy-mm-dd")
End If
End If
'先删除已有记录
txtSQL = "delete from manappraise where pjno='" & Trim(txtItem(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
'再加入新记录
txtSQL = "select * from manappraise"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
mrc.Fields(0) = cboItem(0)
mrc.Fields(1) = cboItem(1)
For intCount = 0 To 8
mrc.Fields(intCount + 2) = Trim(txtItem(intCount))
Next intCount
mrc.Update
mrc.Close
If gintMode = 1 Then
MsgBox " 添加记录成功!", vbOKOnly + vbExclamation, "警告"
For intCount = 0 To 8
txtItem(intCount) = ""
Next intCount
txtItem(0) = GetNo
mblChange = False
ElseIf gintMode = 2 Then
MsgBox " 修改记录成功!", vbOKOnly + vbExclamation, "警告"
Unload Me
End If
Exit Sub
End Sub
Private Sub Form_Load()
Dim MsgText As String
Dim intCount As Integer
If gintMode = 1 Then
Me.Caption = Me.Caption & "添加"
txtItem(0) = GetNo
'初始化部门名称
txtSQL = "select DISTINCT ygdept from manrecord"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If Not mrc.EOF Then
Do While Not mrc.EOF
cboItem(0).AddItem Trim(mrc!ygdept)
mrc.MoveNext
Loop
cboItem(0).ListIndex = 0
Else
MsgBox "请先进行员工档案登记!", vbOKOnly + vbExclamation, "警告"
cmdSave.Enabled = False
Exit Sub
End If
ElseIf gintMode = 2 Then
txtSQL = "select * from manappraise"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
With mrc
cboItem(0).AddItem .Fields(0)
cboItem(1).AddItem .Fields(1)
cboItem(0).ListIndex = 0
cboItem(1).ListIndex = 0
For intCount = 0 To 8
If Not IsNull(.Fields(intCount + 2)) Then
txtItem(intCount) = .Fields(intCount + 2)
End If
Next intCount
End With
End If
If gintMode = 3 Then
cmdSave.Enabled = False
Me.Caption = Me.Caption & "内容"
Else
Me.Caption = Me.Caption & "修改"
End If
End If
mblChange = False
End Sub
Private Sub txtItem_Change(Index As Integer)
'有变化设置gblchange
mblChange = True
End Sub
Private Sub txtItem_GotFocus(Index As Integer)
txtItem(Index).SelStart = 0
txtItem(Index).SelLength = Len(txtItem(Index))
End Sub
Private Sub txtItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
EnterToTab KeyCode
End Sub
Private Function GetNo() As String
GetNo = Format(Now, "yymmddhhmmss")
Randomize
GetNo = GetNo & Int((99 - 10 + 1) * Rnd + 10)
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -