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

📄 main_rsxx_lr.frm

📁 从网络上下载的VB的人事档案管理系统,经过修改.加入了些功能.希望对大家有帮助
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Left            =   135
         TabIndex        =   27
         Top             =   3645
         Width           =   7020
      End
      Begin VB.Label Label5 
         BackStyle       =   0  'Transparent
         Caption         =   "婚姻状况:             政治面貌:                 民族:"
         Height          =   255
         Left            =   135
         TabIndex        =   24
         Top             =   3165
         Width           =   7020
      End
      Begin VB.Label Label4 
         BackStyle       =   0  'Transparent
         Caption         =   "联系电话:                              部门名称:              "
         Height          =   255
         Left            =   135
         TabIndex        =   20
         Top             =   2685
         Width           =   7020
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   "聘用日期:                   家庭住址:"
         Height          =   255
         Left            =   135
         TabIndex        =   18
         Top             =   2220
         Width           =   7020
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Caption         =   "籍贯:                                      工龄:                    相片:"
         Height          =   255
         Left            =   135
         TabIndex        =   16
         Top             =   1725
         Width           =   7020
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "性别:                      出生日期:                      身份证号:"
         ForeColor       =   &H00000000&
         Height          =   315
         Index           =   1
         Left            =   135
         TabIndex        =   15
         Top             =   1215
         Width           =   7395
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "工号:                      姓    名:                      曾 用 名:"
         ForeColor       =   &H00000000&
         Height          =   315
         Index           =   0
         Left            =   135
         TabIndex        =   11
         Top             =   735
         Width           =   7395
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "档案编号:"
         ForeColor       =   &H00000000&
         Height          =   315
         Index           =   6
         Left            =   135
         TabIndex        =   10
         Top             =   225
         Width           =   1065
      End
   End
   Begin VB.CommandButton CmdSave 
      BackColor       =   &H00FFC0C0&
      Caption         =   "保存"
      Height          =   390
      Left            =   5775
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   5550
      Width           =   1530
   End
   Begin VB.Label Label10 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H00FFC0C0&
      BorderStyle     =   1  'Fixed Single
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C000C0&
      Height          =   375
      Left            =   2295
      TabIndex        =   40
      Top             =   120
      Width           =   4095
   End
   Begin VB.Label Label8 
      BackStyle       =   0  'Transparent
      Caption         =   "相片路径:"
      ForeColor       =   &H000000FF&
      Height          =   210
      Left            =   105
      TabIndex        =   39
      Top             =   5655
      Width           =   900
   End
   Begin VB.Label Lblxplj 
      BackStyle       =   0  'Transparent
      ForeColor       =   &H000000FF&
      Height          =   495
      Left            =   990
      TabIndex        =   37
      Top             =   5520
      Width           =   4695
   End
End
Attribute VB_Name = "main_rsxx_lr"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim i As Integer     '定义整型变量
Dim rs1 As New ADODB.Recordset     '定义数据集对象

Private Sub Cbo1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then DTP1.SetFocus
End Sub

Private Sub Cbo2_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Cbo3.SetFocus

End Sub

Private Sub Cbo3_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Txt1(9).SetFocus

End Sub

Private Sub Cbo4_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Txt1(11).SetFocus

End Sub

Private Sub Cbo5_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Txt1(12).SetFocus

End Sub

Private Sub Cbo6_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Cbo7.SetFocus

End Sub
Private Sub Cbo7_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then CmdSave.SetFocus

End Sub

Private Sub DataCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Cbo2.SetFocus

End Sub

Private Sub DTP1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Txt1(4).SetFocus

End Sub

Private Sub DTP2_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Txt1(7).SetFocus

End Sub

Private Sub Form_Load()
  Cbo1.AddItem ("男")
  Cbo1.AddItem ("女")
  Cbo1.ListIndex = 0
  Cbo2.AddItem ("未婚")
  Cbo2.AddItem ("已婚")
  Cbo2.AddItem ("再婚")
  Cbo2.ListIndex = 0
  Cbo3.AddItem ("无")
  Cbo3.AddItem ("团员")
  Cbo3.AddItem ("党员")
  Cbo3.ListIndex = 0
  Cbo4.AddItem ("初中及以下")
  Cbo4.AddItem ("中专/高中")
  Cbo4.AddItem ("专科")
  Cbo4.AddItem ("本科")
  Cbo4.AddItem ("研究生")
  Cbo4.ListIndex = 1
  Cbo5.AddItem ("正式工")
  Cbo5.AddItem ("临时工")
  Cbo5.AddItem ("合同工")
  Cbo5.ListIndex = 0
  For i = 1 To 10
      Cbo6.AddItem i & "级"
  Next i
  Cbo6.ListIndex = 0
  Cbo7.AddItem ("在职")
  Cbo7.AddItem ("离职")
  Cbo7.ListIndex = 0
End Sub
Private Sub Form_Activate()
  Txt1(2).SetFocus
  Adodc1.ConnectionString = Cnn
Adodc1.RecordSource = "select * from 部门信息表"
Adodc1.Refresh
End Sub
Private Sub PicPhoto_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then DTP2.SetFocus
End Sub

Private Sub Txt1_GotFocus(Index As Integer)
  Txt1(Index).SelStart = 0
  Txt1(Index).SelLength = Len(Txt1(Index))
End Sub

Private Sub Txt1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  '回车获得焦点
  If KeyCode = vbKeyReturn And Index < 12 Then Txt1(Index + 1).SetFocus
  If KeyCode = vbKeyReturn And Index = 2 Then Txt1(3).SetFocus
  If KeyCode = vbKeyReturn And Index = 3 Then Cbo1.SetFocus
  If KeyCode = vbKeyReturn And Index = 6 Then PicPhoto.SetFocus
  If KeyCode = vbKeyReturn And Index = 7 Then Txt1(8).SetFocus
  If KeyCode = vbKeyReturn And Index = 8 Then DataCombo1.SetFocus
  If KeyCode = vbKeyReturn And Index = 9 Then Txt1(10).SetFocus
  If KeyCode = vbKeyReturn And Index = 10 Then Cbo4.SetFocus
  If KeyCode = vbKeyReturn And Index = 11 Then Cbo5.SetFocus
  If KeyCode = vbKeyReturn And Index = 12 Then Cbo6.SetFocus
End Sub
Private Sub CmdSave_Click()
  Dim a As String
  rs1.Open "select * from 人事档案信息表 where 工号='" & Txt1(1).Text & "'order by 工号", Cnn, adOpenKeyset, adLockOptimistic
  If rs1.RecordCount > 0 Then
     a = MsgBox("您确实要修改这条数据吗?", vbYesNo)
     If a = vbYes Then
        For i = 0 To 3
            If Txt1(1).Text <> "" Then rs1.Fields(i) = Trim(Txt1(i).Text)
        Next i
        rs1.Fields("性别") = Cbo1.Text
        rs1.Fields("出生日期") = DTP1.Value
        rs1.Fields("身份证号") = Txt1(4).Text
        rs1.Fields("相片") = Lblxplj.Caption
        rs1.Fields("籍贯") = Txt1(5).Text
        rs1.Fields("工龄") = Txt1(6).Text
        rs1.Fields("聘用日期") = DTP2.Value
        rs1.Fields("家庭住址") = Txt1(7).Text
        rs1.Fields("联系电话") = Txt1(8).Text
        rs1.Fields("部门名称") = DataCombo1.Text
        rs1.Fields("婚姻状况") = Cbo2.Text
        rs1.Fields("政治面貌") = Cbo3.Text
        rs1.Fields("民族") = Txt1(9).Text
        rs1.Fields("技术职称") = Txt1(10).Text
        rs1.Fields("文化程度") = Cbo4.Text
        rs1.Fields("行政职务") = Txt1(11).Text
        rs1.Fields("用工性质") = Cbo5.Text
        rs1.Fields("健康状况") = Txt1(12).Text
        rs1.Fields("工资级别") = Cbo6.Text
        rs1.Fields("员工状态") = Cbo7.Text
        rs1.Update
        main_rsxx.Adodc1.Refresh
     End If
  Else
  If Txt1(2).Text = "" Then
     MsgBox "姓名不允许为空!"
     Exit Sub
  End If
  '新增人员
  rs1.AddNew
  For i = 0 To 3
      If Txt1(1).Text <> "" Then rs1.Fields(i) = Trim(Txt1(i).Text)
  Next i
  rs1.Fields("性别") = Cbo1.Text
  rs1.Fields("出生日期") = DTP1.Value
  rs1.Fields("身份证号") = Txt1(4).Text
  rs1.Fields("相片") = Lblxplj.Caption
  rs1.Fields("籍贯") = Txt1(5).Text
  rs1.Fields("工龄") = Txt1(6).Text
  rs1.Fields("聘用日期") = DTP2.Value
  rs1.Fields("家庭住址") = Txt1(7).Text
  rs1.Fields("联系电话") = Txt1(8).Text
  rs1.Fields("部门名称") = DataCombo1.Text
  rs1.Fields("婚姻状况") = Cbo2.Text
  rs1.Fields("政治面貌") = Cbo3.Text
  rs1.Fields("民族") = Txt1(9).Text
  rs1.Fields("技术职称") = Txt1(10).Text
  rs1.Fields("文化程度") = Cbo4.Text
  rs1.Fields("行政职务") = Txt1(11).Text
  rs1.Fields("用工性质") = Cbo5.Text
  rs1.Fields("健康状况") = Txt1(12).Text
  rs1.Fields("工资级别") = Cbo6.Text
  rs1.Fields("员工状态") = Cbo7.Text
  rs1.Update
  main_rsxx.Adodc1.Refresh
  main_rsbd.Adodc1.Refresh
  End If
  '关闭数据集对象
  rs1.Close
  Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
 frm_main.Enabled = True
End Sub
Private Sub CmdEnd_Click()
  Unload Me
End Sub

Private Sub Lbljrxp_Click()
  '添加职工相片
  With CDialog1
       .DialogTitle = "选择要加入的职工相片"
       .Filter = "jpg图片|*.jpg"
       .ShowOpen     '打开对话框
       Image1.Picture = LoadPicture(.FileName)
       PicPhoto.Picture = LoadPicture(.FileName)
       Lblxplj.Caption = .FileName
  End With
End Sub

⌨️ 快捷键说明

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