📄 职务工资标准管理.frm
字号:
VERSION 5.00
Begin VB.Form DutyManage
Caption = "职务工资标准管理"
ClientHeight = 3990
ClientLeft = 60
ClientTop = 450
ClientWidth = 7275
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 3990
ScaleWidth = 7275
Begin VB.TextBox txtWage
Height = 495
Index = 1
Left = 1440
TabIndex = 11
Top = 1680
Width = 1215
End
Begin VB.TextBox txtWage
Height = 495
Index = 2
Left = 4440
TabIndex = 10
Top = 360
Width = 1215
End
Begin VB.TextBox txtWage
Height = 495
Index = 3
Left = 4440
TabIndex = 9
Top = 1560
Width = 1215
End
Begin VB.TextBox txtWage
Height = 495
Index = 4
Left = 1440
TabIndex = 8
Top = 2880
Width = 1215
End
Begin VB.TextBox txtWage
Height = 495
Index = 0
Left = 1440
TabIndex = 7
Top = 360
Width = 1215
End
Begin VB.CommandButton cmdExit
Cancel = -1 'True
Caption = "关闭"
Height = 495
Left = 5400
TabIndex = 1
Top = 2760
Width = 1215
End
Begin VB.CommandButton cmdSave
Caption = "保存"
Default = -1 'True
Height = 495
Left = 3480
TabIndex = 0
Top = 2760
Width = 1215
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "一般:"
Height = 180
Left = 540
TabIndex = 6
Top = 3000
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "副科级:"
Height = 180
Left = 3480
TabIndex = 5
Top = 1680
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "正科级:"
Height = 180
Left = 3480
TabIndex = 4
Top = 480
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "副处级:"
Height = 180
Left = 360
TabIndex = 3
Top = 1740
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "正处级:"
Height = 180
Left = 360
TabIndex = 2
Top = 480
Width = 720
End
End
Attribute VB_Name = "DutyManage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'一个单位应只有一个职务工资标准,所以窗体中仅显示了一个记录数据。
Dim objCn As Connection, objRs As Recordset
'objCn用于建立数据库连接,objRs用于保存"职务工资"表数据
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdSave_Click()
On Error GoTo DealError
strNews = Array("正处", "副处", "正科", "副科", "一般")
For i = 0 To 4 '验证设定的工资标准
If txtWage(i) = "" Or Not IsNumeric(txtWage(i)) Then
MsgBox strNews(i) & "级工资标准不能为空,且必须为数字!", vbCritical, "职务工资标准设定"
txtWage(i).SetFocus
txtWage(i).SelStart = 0
txtWage(i).SelLength = Len(txtWage(i))
Exit Sub
End If
Next
With objRs '保存工资标准
If .RecordCount = 0 Then .AddNew
.Fields(0) = txtWage(0)
.Fields(1) = txtWage(1)
.Fields(2) = txtWage(2)
.Fields(3) = txtWage(3)
.Fields(4) = txtWage(4)
.Update
End With
MsgBox "数据保存成功!", vbInformation, "职务工资标准设定"
Exit Sub
DealError:
msg = "程序执行出错,错误信息如下:" & vbCrLf & Err.Description
ShowError msg
End Sub
Private Sub Form_Load()
On Error GoTo DealError
'建立数据库连接
Set objCn = New Connection
strcn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\工资管理.mdb"
objCn.ConnectionString = strcn
objCn.Open
'创建Recordset对象,获取系统用户数据
Set objRs = New Recordset
Set objRs.ActiveConnection = objCn
objRs.CursorLocation = adUseClient
objRs.CursorType = adOpenDynamic
objRs.LockType = adLockOptimistic
Strsql = "SELECT * FROM 职务工资"
objRs.Open Strsql
' 显示数据
If objRs.BOF And objRs.EOF Then
MsgBox "无记录"
Else
For i = 0 To 4
txtWage(i) = objRs.Fields(i)
Next
End If
Exit Sub
DealError:
msg = "程序执行出错,错误信息如下:" & vbCrLf & Err.Description
ShowError msg
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set objRs = Nothing
objCn.Close
Set objCn = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -