📄 tjzy.frm
字号:
VERSION 5.00
Begin VB.Form tjzy
BorderStyle = 1 'Fixed Single
Caption = "添加职员"
ClientHeight = 4260
ClientLeft = 5835
ClientTop = 2595
ClientWidth = 5100
Icon = "tjzy.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4260
ScaleWidth = 5100
Begin VB.CommandButton Command1
Caption = "保存(&S)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 240
TabIndex = 16
Top = 3720
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "继续添加(&A)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1680
TabIndex = 15
Top = 3720
Width = 1575
End
Begin VB.CommandButton Command3
Caption = "返回(&B)"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3480
TabIndex = 14
Top = 3720
Width = 1215
End
Begin VB.Frame Frame1
Height = 3615
Left = 0
TabIndex = 0
Top = 0
Width = 5055
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 495
Left = 120
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 2640
Visible = 0 'False
Width = 1500
End
Begin VB.TextBox Text5
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 375
Left = 2040
TabIndex = 13
ToolTipText = "在编号后加上所在部门的代码"
Top = 360
Width = 2415
End
Begin VB.TextBox Text4
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2040
TabIndex = 12
Top = 840
Width = 2415
End
Begin VB.OptionButton Option2
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 255
Left = 3480
TabIndex = 11
Top = 1440
Width = 255
End
Begin VB.OptionButton Option1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 255
Left = 2280
TabIndex = 10
Top = 1440
Value = -1 'True
Width = 255
End
Begin VB.TextBox Text3
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2040
TabIndex = 9
Top = 1920
Width = 2415
End
Begin VB.TextBox Text2
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2040
TabIndex = 8
Top = 2400
Width = 2415
End
Begin VB.TextBox Text1
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2040
MultiLine = -1 'True
TabIndex = 7
Top = 2880
Width = 2415
End
Begin VB.Image Image3
Height = 480
Left = 3840
Picture = "tjzy.frx":0442
Top = 1320
Width = 480
End
Begin VB.Image Image2
Height = 480
Left = 2520
Picture = "tjzy.frx":05E7
Top = 1320
Width = 480
End
Begin VB.Label Label6
Caption = "性别"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 840
TabIndex = 6
Top = 1440
Width = 615
End
Begin VB.Label Label5
Caption = "备注:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 5
Top = 3120
Width = 735
End
Begin VB.Label Label4
Caption = "所在部门"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 4
Top = 2400
Width = 975
End
Begin VB.Label Label3
Caption = "联系方式"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 3
Top = 1920
Width = 1095
End
Begin VB.Label Label2
Caption = "姓名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 2
Top = 840
Width = 615
End
Begin VB.Label Label1
Caption = "职员编号"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 1
Top = 360
Width = 1095
End
End
End
Attribute VB_Name = "tjzy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public bc As Boolean
Private Sub Command1_Click()
'czrygl.Data1.Recordset.MoveLast
bc = True
If Text4.Text = "" Then
MsgBox "姓名不能为空。", vbCritical, "警告"
Text4.SetFocus
Exit Sub
End If
If Len(Text1.Text) > 50 Then
MsgBox "备注不要多于25个字", vbCritical, "警告"
Text1.SetFocus
Exit Sub
End If
tjzy.Data1.Recordset.AddNew
tjzy.Data1.Recordset("zybh") = Trim(Text5.Text)
tjzy.Data1.Recordset("xm") = Trim(Text4.Text)
If Option1.Value = True Then
tjzy.Data1.Recordset("xb") = "男"
Else
tjzy.Data1.Recordset("xb") = "女"
End If
tjzy.Data1.Recordset("lxfs") = Trim(Text3.Text)
tjzy.Data1.Recordset("szbm") = Trim(Text2.Text)
tjzy.Data1.Recordset("bz") = Trim(Text1.Text)
tjzy.Data1.Recordset.Update
'Call Form_Activate
tjzy.Data1.Refresh
zyxx.Data1.Refresh
End Sub
Private Sub Command2_Click()
'自动生成编号
If bc = False Then
MsgBox "请先将当前记录保存。", vbInformation, "提示"
Exit Sub
End If
Data1.Recordset.MoveLast
If (Val(Data1.Recordset("zybh")) + 1) < 10 Then Text5.Text = "000" & (Val(Data1.Recordset("zybh")) + 1)
If (Val(Data1.Recordset("zybh")) + 1) >= 10 And (Val(Data1.Recordset("zybh")) + 1) < 100 Then
Text5.Text = "00" & (Val(Data1.Recordset("zybh")) + 1)
End If
If (Val(Data1.Recordset("zybh")) + 1) >= 100 Then
Text5.Text = "0" + (Val(Data1.Recordset("zybh")) + 1)
End If
Text4.Text = ""
Text3.Text = ""
Text2.Text = ""
Text1.Text = ""
bc = False
End Sub
Private Sub Command3_Click()
zyxx.Show
Unload Me
End Sub
Private Sub Form_Activate()
'自动生成编号
Data1.Recordset.MoveLast
If (Val(Data1.Recordset("zybh")) + 1) < 10 Then Text5.Text = "000" & (Val(Data1.Recordset("zybh")) + 1)
If (Val(Data1.Recordset("zybh")) + 1) >= 10 And (Val(Data1.Recordset("zybh")) + 1) < 100 Then
Text5.Text = "00" & (Val(Data1.Recordset("zybh")) + 1)
End If
If (Val(Data1.Recordset("zybh")) + 1) > 100 Then
Text5.Text = "0" + (Val(Data1.Recordset("zybh")) + 1)
End If
Text5.SetFocus
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\db1.mdb"
Data1.RecordSource = "select * from zyzl"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -