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

📄 main_rsgl_rsdaxx_lr.frm

📁 花几周时间做的企业人事管理系统
💻 FRM
📖 第 1 页 / 共 3 页
字号:
         Caption         =   "联系电话:"
         Height          =   225
         Left            =   120
         TabIndex        =   23
         Top             =   1920
         Width           =   930
      End
      Begin VB.Label Label11 
         Caption         =   "籍贯:"
         Height          =   225
         Left            =   3165
         TabIndex        =   22
         Top             =   1725
         Width           =   540
      End
      Begin VB.Label Label10 
         Caption         =   "政治面貌:"
         Height          =   195
         Left            =   2865
         TabIndex        =   21
         Top             =   1365
         Width           =   915
      End
      Begin VB.Label Label9 
         Caption         =   "婚姻状况:"
         Height          =   225
         Left            =   120
         TabIndex        =   18
         Top             =   1440
         Width           =   930
      End
      Begin VB.Label Label7 
         Caption         =   "民族:"
         Height          =   195
         Left            =   4470
         TabIndex        =   17
         Top             =   990
         Width           =   570
      End
      Begin VB.Label Label6 
         Caption         =   "出生年月:"
         Height          =   195
         Left            =   120
         TabIndex        =   15
         Top             =   990
         Width           =   915
      End
      Begin VB.Label Label5 
         Caption         =   "身份证号:"
         Height          =   195
         Left            =   2865
         TabIndex        =   11
         Top             =   630
         Width           =   915
      End
      Begin VB.Label Label4 
         Caption         =   "性别:"
         Height          =   225
         Left            =   360
         TabIndex        =   9
         Top             =   600
         Width           =   570
      End
      Begin VB.Label Label3 
         Caption         =   "照片:"
         Height          =   195
         Left            =   6630
         TabIndex        =   8
         Top             =   330
         Width           =   585
      End
      Begin VB.Label Label2 
         Caption         =   "姓名:"
         Height          =   195
         Left            =   3120
         TabIndex        =   7
         Top             =   300
         Width           =   585
      End
      Begin VB.Label Label1 
         Caption         =   "编号:"
         Height          =   195
         Left            =   360
         TabIndex        =   6
         Top             =   240
         Width           =   585
      End
   End
End
Attribute VB_Name = "main_rsgl_rsdaxx_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     '定义数据集对象
Public photoFilename As String
Dim mst As New ADODB.Stream

Private Sub cmdDept_Click()
  deptMark = 2
  Load main_datatree
  main_datatree.Show 1
End Sub
Private Sub cmdPhotoAdd_Click()
  '添加职工相片
  With CommonDialog1
       .DialogTitle = "选择要加入的职工相片"
       .Filter = "jpg图片|*.jpg"
       .ShowOpen     '打开对话框
       PicPhoto.Picture = LoadPicture(.FileName)
       photoFilename = .FileName
  End With
End Sub



Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Txt1(2).SetFocus
End Sub
Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then DataCombo2.SetFocus
End Sub
Private Sub DataCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Combo2.SetFocus
End Sub
Private Sub DataCombo2_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Txt1(3).SetFocus
End Sub
Private Sub DataCombo3_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Txt1(9).SetFocus
End Sub

Private Sub DataCombo5_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then DataCombo6.SetFocus
End Sub
Private Sub DataCombo6_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Txt1(12).SetFocus
End Sub
Private Sub DTP1_Change()
  Txt1(17) = DateDiff("yyyy", DTP1.Value, Date)
End Sub
Private Sub DTP1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then DataCombo1.SetFocus
End Sub

Private Sub DTP3_Change()
  Txt1(10) = Val(Left(Date, 4)) - Val(Left(DTP3, 4))
End Sub
Private Sub DTP3_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then Txt1(10).SetFocus
End Sub

Private Sub Form_Load()
  Combo1.AddItem ("男")
  Combo1.AddItem ("女")
  Combo1.ListIndex = 0
  Combo2.AddItem ("未婚")
  Combo2.AddItem ("已婚")
  Combo2.AddItem ("再婚")
  Combo2.ListIndex = 0
  If blnAddRS = True Then
    Me.Caption = "人事信息添加"
    rs1.Open "select * from 人事表 order by 编号", Cnn, adOpenKeyset, adLockOptimistic
    If rs1.RecordCount > 0 Then
       rs1.MoveLast
       Txt1(0) = Format(Val(rs1.Fields("编号")) + 1, "00000")
    Else
       Txt1(0) = "00001"
    End If
    rs1.Close

  Else
    Me.Caption = "人事信息修改"
    With main_rsgl_rsdaxx.Adodc1.Recordset
     If .RecordCount > 0 Then
         Txt1(0) = .Fields("编号")
         Txt1(1) = .Fields("姓名")
         Combo1.text = .Fields("性别")
         Txt1(2) = .Fields("身份证号")
         DTP1.Value = .Fields("出生年月")
         Txt1(17) = .Fields("年龄")
         DataCombo1 = .Fields("民族")
         Combo2 = .Fields("婚姻状况")
         DataCombo2 = .Fields("政治面貌")
         Txt1(3) = .Fields("籍贯")
         Txt1(4) = .Fields("联系电话")
         Txt1(5) = .Fields("手机号码")
         Txt1(6) = .Fields("家庭地址")
         Txt1(7) = .Fields("毕业院校")
         Txt1(8) = .Fields("专业")
         DataCombo3 = .Fields("文化程度")
         Txt1(9) = .Fields("特长")
         DTP3.Value = .Fields("参加工作时间")
         Set PicPhoto.DataSource = main_rsgl_rsdaxx.Adodc1
         PicPhoto.DataField = "照片"
          If .Fields("照片") Is Nothing Then
           PicPhoto.Picture = LoadPicture()
         End If
         Txt1(11) = .Fields("部门")
         DataCombo5 = .Fields("职务")
         DataCombo6 = .Fields("职称")
         Txt1(12) = .Fields("基本工资")
         If .Fields("简历") <> "" Then Txt1(15) = .Fields("简历")
    End If
   End With
  End If
  
  
End Sub
Private Sub Form_Activate()
  Txt1(1).SetFocus
End Sub

Private Sub Txt1_GotFocus(index As Integer)
  Txt1(index).BackColor = &HFFFF00
  Txt1(index).SelStart = 0
  Txt1(index).SelLength = Len(Txt1(index))
End Sub
Private Sub Txt1_LostFocus(index As Integer)
  Txt1(index).BackColor = &H80000005
End Sub
Private Sub Txt1_KeyDown(index As Integer, KeyCode As Integer, Shift As Integer)
  '回车获得焦点
  If KeyCode = vbKeyReturn And index > 2 And index < 8 Then Txt1(index + 1).SetFocus
  If KeyCode = vbKeyReturn And index = 1 Then Combo1.SetFocus
  If KeyCode = vbKeyReturn And index = 2 Then DTP1.SetFocus
  If KeyCode = vbKeyReturn And index = 8 Then DataCombo3.SetFocus
  If KeyCode = vbKeyReturn And index = 9 Then DTP3.SetFocus
  If KeyCode = vbKeyReturn And index = 10 Then Txt1(11).SetFocus
  If KeyCode = vbKeyReturn And index = 11 Then cmdDept.SetFocus
  If KeyCode = vbKeyReturn And index = 12 Then Txt1(13).SetFocus
  If KeyCode = vbKeyReturn And index = 14 Then Txt1(15).SetFocus
  If KeyCode = vbKeyReturn And index = 16 Then CmdSave.SetFocus
End Sub
Private Sub cmdSave_Click()
  Dim A As Long
  If blnAddRS = False Then
    A = MsgBox("您确实要修改这条数据吗?", vbYesNo)
    If A = vbYes Then
     rs1.Open "select * from 人事表 where 编号='" + Txt1(0).text + "'", Cnn, adOpenKeyset, adLockOptimistic
   If rs1.RecordCount > 0 Then
    rs1.Fields("编号") = Txt1(0)
    rs1.Fields("姓名") = Txt1(1)
    rs1.Fields("性别") = Combo1.text
    rs1.Fields("身份证号") = Txt1(2)
    rs1.Fields("出生年月") = DTP1.Value
    rs1.Fields("年龄") = Txt1(17)
    rs1.Fields("民族") = DataCombo1
    rs1.Fields("婚姻状况") = Combo2
    rs1.Fields("政治面貌") = DataCombo2
    rs1.Fields("籍贯") = Txt1(3)
    rs1.Fields("联系电话") = Txt1(4)
    rs1.Fields("手机号码") = Txt1(5)
    rs1.Fields("家庭地址") = Txt1(6)
    rs1.Fields("毕业院校") = Txt1(7)
    rs1.Fields("专业") = Txt1(8)
    rs1.Fields("文化程度") = DataCombo3
    rs1.Fields("特长") = Txt1(9)
    rs1.Fields("参加工作时间") = DTP3.Value
    mst.Type = adTypeBinary
    mst.Open
    If photoFilename <> "" Then mst.LoadFromFile photoFilename
    rs1.Fields("照片") = mst.Read
    rs1.Fields("部门") = Txt1(11)
    rs1.Fields("职务") = DataCombo5
    rs1.Fields("职称") = DataCombo6
    rs1.Fields("基本工资") = Val(Txt1(12))
    rs1.Fields("简历") = Txt1(15)
    rs1.Update
    main_rsgl_rsdaxx.Adodc1.Refresh
    End If
    rs1.Close
    mst.Close
   End If
  Else
    If Txt1(1).text = "" Then
       MsgBox "姓名不允许为空!"
       Exit Sub
    End If
    rs1.Open "select * from 人事表", Cnn, adOpenKeyset, adLockOptimistic
    '新增人员
    rs1.AddNew
    rs1.Fields("编号") = Txt1(0)
    rs1.Fields("姓名") = Txt1(1)
    rs1.Fields("性别") = Combo1.text
    rs1.Fields("身份证号") = Txt1(2)
    rs1.Fields("出生年月") = DTP1.Value
    rs1.Fields("年龄") = Txt1(17)
    rs1.Fields("民族") = DataCombo1
    rs1.Fields("婚姻状况") = Combo2
    rs1.Fields("政治面貌") = DataCombo2
    rs1.Fields("籍贯") = Txt1(3)
    rs1.Fields("联系电话") = Txt1(4)
    rs1.Fields("手机号码") = Txt1(5)
    rs1.Fields("家庭地址") = Txt1(6)
    rs1.Fields("毕业院校") = Txt1(7)
    rs1.Fields("专业") = Txt1(8)
    rs1.Fields("文化程度") = DataCombo3
    rs1.Fields("特长") = Txt1(9)
    rs1.Fields("参加工作时间") = DTP3.Value
    mst.Type = adTypeBinary
    mst.Open
    If photoFilename <> "" Then mst.LoadFromFile photoFilename

    rs1.Fields("照片") = mst.Read
    rs1.Fields("部门") = Txt1(11)
    rs1.Fields("职务") = DataCombo5
    rs1.Fields("职称") = DataCombo6
    rs1.Fields("基本工资") = Val(Txt1(12))
    rs1.Fields("简历") = Txt1(15)
    rs1.Update
    main_rsgl_rsdaxx.Adodc1.Refresh
    rs1.Close
    mst.Close
  End If
  Unload Me
End Sub
Private Sub CmdEnd_Click()
  Unload Me
End Sub


⌨️ 快捷键说明

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