⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmempadd.frm

📁 员工信息管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "政治面貌"
         Height          =   375
         Index           =   14
         Left            =   4920
         TabIndex        =   27
         Top             =   1920
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "毕业学校:"
         Height          =   375
         Index           =   12
         Left            =   240
         TabIndex        =   25
         Top             =   2040
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "专  业:"
         Height          =   375
         Index           =   5
         Left            =   360
         TabIndex        =   17
         Top             =   1440
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "学  历:"
         Height          =   375
         Index           =   4
         Left            =   4920
         TabIndex        =   16
         Top             =   1440
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "籍  贯:"
         Height          =   375
         Index           =   3
         Left            =   4920
         TabIndex        =   15
         Top             =   840
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "生  日:"
         Height          =   375
         Index           =   2
         Left            =   360
         TabIndex        =   14
         Top             =   960
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "性  别:"
         Height          =   375
         Index           =   1
         Left            =   4920
         TabIndex        =   13
         Top             =   480
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "姓  名:"
         Height          =   375
         Index           =   0
         Left            =   360
         TabIndex        =   12
         Top             =   480
         Width           =   735
      End
   End
   Begin VB.Label Label1 
      Caption         =   "专  业:"
      Height          =   375
      Index           =   13
      Left            =   5280
      TabIndex        =   26
      Top             =   2280
      Width           =   735
   End
End
Attribute VB_Name = "frmEmpAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim rs As New ADODB.Recordset
Dim strSql As String

Private Sub cmdAdd_Click()
    If Trim(txtNative.Text) = "" Then
        txtNative.Text = " "
    End If
    
    If Trim(txtEmpPro.Text) = "" Then
        txtEmpPro.Text = " "
    End If
    
    If Trim(txtEmp_des.Text) = "" Then
        txtEmp_des.Text = " "
    End If
    
    If Trim(txtEmp_name.Text) = "" Then
        MsgBox "姓名不能为空,请重新输入!", vbOKOnly + vbExclamation, "警告"
        txtEmp_name.Text = ""
        txtEmp_name.SetFocus
        Exit Sub
    End If
    
    If Not IsDate(Trim(txtbirthday.Text)) Then
       MsgBox "生日必须为合法日期,请重新输入!", vbOKOnly + vbExclamation, "警告"
       txtbirthday.Text = "    -  -  "
       txtbirthday.SetFocus
        Exit Sub
    End If

    If Not IsDate(Trim(txtEmpDate1.Text)) Then
        MsgBox "参加工作时间必须为合法日期,请重新输入!", vbOKOnly + vbExclamation, "警告"
       txtEmpDate1.Text = "    -  -  "
        txtEmpDate1.SetFocus
        Exit Sub
    End If

    If Not IsDate(Trim(txtEmpDate2.Text)) Then
        MsgBox "进入公司时间必须为合法日期,请重新输入!", vbOKOnly + vbExclamation, "警告"
        txtEmpDate2.Text = "    -  -  "
        txtEmpDate2.SetFocus
        Exit Sub
    End If
    
    If Trim(zzmm.Text) = "" Then
        MsgBox "政治面貌不能为空!", vbOKOnly + vbExclamation, "警告"
        zzmm.Text = ""
        zzmm.SetFocus
        Exit Sub
    End If
    
    If Trim(ygxz.Text) = "" Then
        MsgBox "用工性质不能为空!", vbOKOnly + vbExclamation, "警告"
        ygxz.Text = ""
        ygxz.SetFocus
        Exit Sub
    End If
     
    If Trim(ygjstc.Text) = "" Then
        MsgBox "技术特长不能为空!", vbOKOnly + vbExclamation, "警告"
        ygjstc.Text = ""
        ygjstc.SetFocus
        Exit Sub
    End If
     
    If Trim(bisx.Text) = "" Then
        MsgBox "毕业学校不能为空!", vbOKOnly + vbExclamation, "警告"
        bisx.Text = ""
        bisx.SetFocus
        Exit Sub
    End If
    
      If Trim(gzdj.Text) = "" Then
        MsgBox "工资等级不能为空!", vbOKOnly + vbExclamation, "警告"
        gzdj.Text = ""
        gzdj.SetFocus
        Exit Sub
    End If
    
      If Trim(htqx.Text) = "" Then
        MsgBox "合同期限不能为空!", vbOKOnly + vbExclamation, "警告"
        htqx.Text = ""
        htqx.SetFocus
        Exit Sub
    End If
    
    strSql = "Insert into employee (emp_name,sex,birthday,native,profession,edu_id,title_id,dept_id,duty_id,emp_date1,emp_date2,emp_des,zzmm,ygjstc,bisx,ygxz,gzdj,htqx) Values (" & _
             "'" & txtEmp_name.Text & _
             "','" & cboSex.Text & _
             "','" & txtbirthday.Text & _
             "','" & txtNative.Text & _
             "','" & txtEmpPro.Text & _
             "'," & cboEdu.ItemData(cboEdu.ListIndex) & _
             "," & cboTitle.ItemData(cboTitle.ListIndex) & _
             "," & cboDept.ItemData(cboDept.ListIndex) & _
             "," & cboDuty.ItemData(cboDuty.ListIndex) & _
             ",'" & txtEmpDate1.Text & _
             "','" & txtEmpDate2.Text & _
             "','" & txtEmp_des.Text & _
             "','" & zzmm.Text & _
             "','" & ygjstc.Text & _
             "','" & bisx.Text & _
             "','" & ygxz.Text & _
             "','" & gzdj.Text & _
             "','" & htqx.Text & _
             "')"

    dbConn.Execute strSql
    
    MsgBox "增加员工成功!", vbOKOnly + vbInformation, "提示"
    
    txtEmp_name.SetFocus
    txtEmp_name.Text = ""
''    DTPBirthday = ""
'    DTPEmpDate1.Text = "    -  -  "
'    DTPEmpDate2.Text = "    -  -  "
End Sub

Private Sub cmdReturn_Click()
    Unload Me
End Sub

Private Sub Form_Load()
     Me.Icon = LoadPicture(App.Path & "\Graph07.ico")
    '性别
    cboSex.AddItem "男"
    cboSex.AddItem "女"
    cboSex.ListIndex = 0
    
    '学历
    strSql = "Select edu_id,edu_name from education Order By edu_id"
    rs.Open strSql, dbConn, adOpenForwardOnly, adLockReadOnly
    Do While Not rs.EOF
        cboEdu.AddItem (rs.Fields("edu_name").Value)
        cboEdu.ItemData(cboEdu.NewIndex) = rs.Fields("edu_id").Value
        rs.MoveNext
    Loop
    rs.Close
    cboEdu.ListIndex = 3
    
    '部门
    strSql = "Select dept_id,dept_name from department Order By dept_id"
    rs.Open strSql, dbConn, adOpenForwardOnly, adLockReadOnly
    Do While Not rs.EOF
        cboDept.AddItem (rs.Fields("dept_name").Value)
        cboDept.ItemData(cboDept.NewIndex) = rs.Fields("dept_id").Value
        rs.MoveNext
    Loop
    rs.Close
    cboDept.ListIndex = 0
    
    '职务
    strSql = "Select duty_id,duty_name from duty Order By duty_id"
    rs.Open strSql, dbConn, adOpenForwardOnly, adLockReadOnly
    Do While Not rs.EOF
        cboDuty.AddItem (rs.Fields("duty_name").Value)
        cboDuty.ItemData(cboDuty.NewIndex) = rs.Fields("duty_id").Value
        rs.MoveNext
    Loop
    rs.Close
    cboDuty.ListIndex = 0
    
    '职称
    strSql = "Select title_id,title_name from title Order By title_id"
    rs.Open strSql, dbConn, adOpenForwardOnly, adLockReadOnly
    Do While Not rs.EOF
        cboTitle.AddItem (rs.Fields("title_name").Value)
        cboTitle.ItemData(cboTitle.NewIndex) = rs.Fields("title_id").Value
        rs.MoveNext
    Loop
    rs.Close
    cboTitle.ListIndex = 0
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Set rs = Nothing
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -