📄 添加人员信息.frm
字号:
VERSION 5.00
Begin VB.Form Frm_Add
Caption = "添加人员信息"
ClientHeight = 4050
ClientLeft = 60
ClientTop = 345
ClientWidth = 7155
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 4050
ScaleWidth = 7155
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text8
Height = 495
Left = 5760
TabIndex = 20
Text = "Text8"
Top = 4800
Width = 1215
End
Begin VB.TextBox Text5
Height = 495
Left = 3240
TabIndex = 19
Text = "Text5"
Top = 4920
Width = 1215
End
Begin VB.ComboBox Combo2
Height = 300
Left = 4080
TabIndex = 18
Top = 1080
Width = 1815
End
Begin VB.CommandButton Command3
Caption = "自动转换积分"
Height = 495
Left = 3000
TabIndex = 17
Top = 3240
Width = 1215
End
Begin VB.TextBox Text7
Height = 495
Left = 4800
TabIndex = 16
Text = "Text7"
Top = 4800
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 5880
TabIndex = 15
Top = 3240
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 495
Left = 4440
TabIndex = 14
Top = 3240
Width = 1215
End
Begin VB.TextBox Text3
Appearance = 0 'Flat
Height = 270
Left = 960
TabIndex = 8
Top = 2400
Width = 1215
End
Begin VB.ComboBox Combo1
Appearance = 0 'Flat
Height = 300
Left = 960
TabIndex = 7
Top = 1800
Width = 1215
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 390
Left = 960
TabIndex = 4
Top = 1080
Width = 2175
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 375
Left = 960
TabIndex = 2
Top = 480
Width = 2175
End
Begin VB.Frame Frame1
Caption = "人员信息"
Height = 2895
Left = 0
TabIndex = 0
Top = 120
Width = 7095
Begin VB.TextBox Text6
Appearance = 0 'Flat
Height = 375
Left = 4080
TabIndex = 13
Top = 1560
Width = 1815
End
Begin VB.TextBox Text4
Appearance = 0 'Flat
Height = 375
Left = 4080
TabIndex = 10
Top = 360
Width = 855
End
Begin VB.Label Label7
Caption = "政治面貌:"
Height = 375
Left = 3120
TabIndex = 12
Top = 1680
Width = 855
End
Begin VB.Label Label6
Caption = "职务:"
Height = 375
Left = 3480
TabIndex = 11
Top = 1080
Width = 615
End
Begin VB.Label Label5
Caption = "工龄:"
Height = 375
Left = 3480
TabIndex = 9
Top = 480
Width = 735
End
Begin VB.Label Label4
Caption = "年龄:"
Height = 255
Left = 240
TabIndex = 6
Top = 2280
Width = 855
End
Begin VB.Label Label3
Caption = "性别:"
Height = 255
Left = 240
TabIndex = 5
Top = 1680
Width = 615
End
Begin VB.Label Label2
Caption = "姓名:"
Height = 255
Left = 240
TabIndex = 3
Top = 960
Width = 495
End
Begin VB.Label Label1
Caption = "ID:"
Height = 255
Left = 240
TabIndex = 1
Top = 360
Width = 495
End
End
Begin VB.Label Label8
Caption = "先自动转换积分,然后再添加!@!"
Height = 255
Left = 240
TabIndex = 21
Top = 3360
Width = 2535
End
Begin VB.Shape Shape1
Height = 735
Left = 120
Shape = 4 'Rounded Rectangle
Top = 3120
Width = 2775
End
End
Attribute VB_Name = "Frm_Add"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As Database
Dim rs As Recordset
Dim bs As Recordset
Private Sub Command2_Click()
Unload Me
Frm_Main.Show
End Sub
Private Sub Command3_Click()
If Text4.Text <= 5 Then
Text7.Text = 1
ElseIf Text4.Text > 5 And Text4.Text <= 10 Then
Text7.Text = 2
ElseIf Text4.Text > 10 And Text4.Text <= 15 Then
Text7.Text = 3
ElseIf Text4.Text > 15 And Text4.Text <= 20 Then
Text7.Text = 4
ElseIf Text4.Text > 20 And Text4.Text <= 25 Then
Text7.Text = 5
ElseIf Text4.Text > 25 And Text4.Text <= 30 Then
Text7.Text = 6
ElseIf Text4.Text > 30 And Text4.Text <= 35 Then
Text7.Text = 7
ElseIf Text4.Text > 35 And Text4.Text <= 40 Then
Text7.Text = 8
End If
If Combo2.Text = "局级" Then
Text5.Text = 7
ElseIf Combo2.Text = "副局级" Then
Text5.Text = 6
ElseIf Combo2.Text = "处级" Then
Text5.Text = 5
ElseIf Combo2.Text = "副处级" Then
Text5.Text = 4
ElseIf Combo2.Text = "科级" Then
Text5.Text = 3
ElseIf Combo2.Text = "副科级" Then
Text5.Text = 2
ElseIf Combo2.Text = "科员" Then
Text5.Text = 1
End If
Text8.Text = Val(Text7.Text) + Val(Text5.Text)
Command1.Enabled = True
Command3.Enabled = False
End Sub
Private Sub Form_Load()
Set db = OpenDatabase(App.Path & "\sjk1.mdb")
Set rs = db.OpenRecordset("人员信息表")
Set bs = db.OpenRecordset("积分表")
Combo1.AddItem "男"
Combo1.AddItem "女"
Combo2.AddItem "局级"
Combo2.AddItem "副局级"
Combo2.AddItem "处级"
Combo2.AddItem "副处级"
Combo2.AddItem "科级"
Combo2.AddItem "副科级"
Combo2.AddItem "科员"
Command1.Enabled = False
End Sub
Private Sub Command1_Click()
If Text1.Text <> "" Then
rs.AddNew
rs("ID") = Text1.Text
rs("姓名") = Text2.Text
rs("性别") = Combo1.Text
rs("年龄") = Text3.Text
rs("工龄") = Text4.Text
rs("职务") = Combo2.Text
rs("政治面貌") = Text6.Text
rs.Update
bs.AddNew
bs("ID") = Text1.Text
bs("姓名") = Text2.Text
bs("性别") = Combo1.Text
bs("年龄") = Text3.Text
bs("工龄") = Text4.Text
bs("职务") = Combo2.Text
bs("积分") = Text8.Text
bs.Update
MsgBox ("添加成功!")
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Else
MsgBox ("记录不允许为空!")
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -