frmemployee.frm
来自「1:首先要导入hotel数据」· FRM 代码 · 共 477 行 · 第 1/2 页
FRM
477 行
Left = 2880
Locked = -1 'True
TabIndex = 2
Text = "Combo1"
Top = 320
Width = 615
End
Begin VB.TextBox txtName
Height = 270
Left = 720
MaxLength = 8
TabIndex = 1
Top = 320
Width = 1215
End
Begin VB.Label Label1
Caption = "家庭住址"
Height = 255
Index = 9
Left = 3000
TabIndex = 23
Top = 840
Width = 855
End
Begin VB.Label Label1
Caption = "身份证号"
Height = 255
Index = 8
Left = 240
TabIndex = 22
Top = 840
Width = 855
End
Begin VB.Label Label1
Caption = "民 族"
Height = 255
Index = 3
Left = 5400
TabIndex = 20
Top = 360
Width = 615
End
Begin VB.Label Label1
Caption = "年 龄"
Height = 255
Index = 2
Left = 3840
TabIndex = 19
Top = 360
Width = 495
End
Begin VB.Label Label1
Caption = "性 别"
Height = 255
Index = 1
Left = 2280
TabIndex = 18
Top = 360
Width = 495
End
Begin VB.Label Label1
Caption = "姓 名"
Height = 255
Index = 0
Left = 240
TabIndex = 17
Top = 360
Width = 495
End
End
Begin CSCommand.Command cmdQuit
Cancel = -1 'True
Height = 300
Left = 6360
TabIndex = 16
Top = 5160
Width = 975
_ExtentX = 1720
_ExtentY = 529
IconAlign = 0
Icon = "frmEmployee.frx":015D
Caption = "返回(Ese)"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label5
Caption = "添加员工"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 1080
TabIndex = 33
Top = 120
Width = 4455
End
Begin VB.Label Label6
Caption = "工作日期"
Height = 255
Left = 360
TabIndex = 32
Top = 6000
Width = 855
End
Begin VB.Label Label4
Caption = "部 门"
Height = 255
Index = 1
Left = 2400
TabIndex = 29
Top = 4965
Width = 495
End
Begin VB.Label Label4
Caption = "编 号"
Height = 255
Index = 0
Left = 360
TabIndex = 28
Top = 4965
Width = 495
End
End
Attribute VB_Name = "frmEmployeeAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim EmpStr As String '打开员工表(SQL表 "Employee" )所用
Private Sub cmdSave_Click()
'各项主要内容不能为空约束
If txtId.Text = "" Then
MsgBox "职员工号不能为空", vbInformation + vbOKOnly, "添加职员"
txtId.SetFocus
Exit Sub
End If
If txtName.Text = "" Then
MsgBox "职员姓名不能为空", vbInformation + vbOKOnly, "添加职员"
txtName.SetFocus
Exit Sub
End If
If txtCardid.Text = "" Then
MsgBox "职员身份证号不能为空", vbInformation + vbOKOnly, "添加职员"
txtCardid.SetFocus
Exit Sub
End If
If txtAddress.Text = "" Then
MsgBox "职员家庭住址不能为空", vbInformation + vbOKOnly, "添加职员"
txtAddress.SetFocus
Exit Sub
End If
EmpStr = "select * from employee where emp_id='" & txtId.Text & "' "
If mdlCon.connectTotable(con, rs, EmpStr) Then
MsgBox "职工工号相同,核对后重新输入!"
Else
rs.AddNew '员工信息数据添加
rs!emp_id = txtId.Text
rs!emp_dept = cmbDept.Text
rs!emp_workdate = dtpWork.Value
rs!emp_name = txtName.Text
rs!emp_sex = cmbSex.Text
rs!emp_age = cmbAge.Text
rs!emp_nation = cmbNation.Text
rs!emp_cardid = txtCardid.Text
rs!emp_address = txtAddress.Text
rs!emp_graduate = dtpGraduate.Value
rs!emp_school = txtSchool.Text
rs!emp_specialty = txtSpecialty.Text
rs!emp_work1 = txtWork1.Text
rs!emp_work2 = txtWork2.Text
rs!emp_remark = txtRemark.Text
rs.Update
rs.Close
con.Close
MsgBox "信息保存成功!", vbOKOnly, "职员添加"
LoadEmpty '所有数据保存完后各项置空
End If
End Sub
Private Sub cmdQuit_Click()
Unload Me
End Sub
Private Sub Form_Load()
LoadEmpty '窗体加载时所有内容置空
End Sub
'初始窗体函数
Sub LoadEmpty()
cmbSex.AddItem "男"
cmbSex.AddItem "女"
cmbSex.ListIndex = 0
cmbAge.ListIndex = 0
cmbNation.ListIndex = 0
cmbDept.AddItem "实习生"
cmbDept.AddItem "客房部"
cmbDept.AddItem "餐饮部"
cmbDept.AddItem "后勤部"
cmbDept.AddItem "商务部"
cmbDept.ListIndex = 0
dtpWork.Value = Date
txtName.Text = ""
txtCardid.Text = ""
txtAddress.Text = ""
txtSchool.Text = ""
txtSpecialty.Text = ""
txtWork1.Text = ""
txtWork2.Text = ""
txtId.Text = ""
txtRemark.Text = ""
End Sub
'身份证号码输入约束
Private Sub txtCardid_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 45, 46, vbKey0 To vbKey9, vbKeyBack
Case Else
KeyAscii = 0
MsgBox "请输入15或18位证件号码!"
End Select
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?