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

📄 frmmain.frm

📁 VB人事管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
        DataA.RecordSource = "select * from employee"
        DataA.Refresh
        DBGA.Columns("性别").Button = True
        DBGA.Columns("学历").Button = True
        DBGA.Columns("部门").Button = True
        For i = 0 To 2
            mtab(i).Checked = False
        Next i
        mtab(0).Checked = True
        cutable = "employee"
        cuTabCh = True
End Sub
Public Sub showleave() '在DBGA中显示假条信息
        DataA.RecordSource = "select * from leave"
        DataA.Refresh
        For i = 0 To 2
            mtab(i).Checked = False
        Next i
        mtab(1).Checked = True
        cutable = "leave"
        cuTabCh = True
         
End Sub
Public Sub showsalary() '在DBGA中显示工资信息
        DataA.RecordSource = "select * from salary"
        DataA.Refresh
        For i = 0 To 2
            mtab(i).Checked = False
        Next i
        mtab(2).Checked = True
        cutable = "salary"
        cuTabCh = True
End Sub
Private Sub Command1_Click()
    FrmEdit.Show
    FrmMain.Enabled = False
End Sub
Private Sub Command2_Click()
   If DBGA.SelBookmarks.Count = 1 Then
          If MsgBox("确定要删除吗?", vbOKCancel, "确定") = vbOK Then DataA.Recordset.Delete
           cuAp = 0
        Else
           MsgBox "请选择要删除的条目!"
    End If
End Sub
Private Sub Command3_Click()
  FrmSearch.Show
End Sub
Private Sub Command4_Click()
 FrmSetup.Show
End Sub

Private Sub Command5_Click()
 Select Case prnflag
    Case 1
     rsReport.Show
    Case 2
     leave.Show
    Case 3
     salaryreport.Show
   End Select
End Sub

Private Sub Form_Load()
    Dim fil, tbcount, i As Integer
    Dim Tbstr(50), Tbnam(50) As String
    DataA.DatabaseName = App.Path + "\sm.mdb"
    DataB.DatabaseName = App.Path + "\sm.mdb"
    DataB.RecordSource = "select * from employee"
    Call showemployee
     If Dir(App.Path + "\table.ini") = "" Then
        LsDegree.AddItem "定制"
        LsDepart.AddItem "定制"
      Else
        fil = FreeFile()
        Open App.Path + "\table.ini" For Input As #fil
        Do While Not EOF(fil)
            Input #fil, Tbnam(i), Tbstr(i)
              i = i + 1
        Loop
        Close #fil
        tbcount = i
        For i = 0 To tbcount
            If Tbnam(i) = "lsdegree" Then
                LsDegree.AddItem Tbstr(i)
            ElseIf Tbnam(i) = "lsdepart" Then
                LsDepart.AddItem Tbstr(i)
            End If
          Next i
           LsDegree.AddItem "定制"
           LsDepart.AddItem "定制"
    End If
    
End Sub
Private Sub Form_Unload(Cancel As Integer)
    End
End Sub
Private Sub DBGA_ButtonClick(ByVal ColIndex As Integer)
Dim Co As Column
    Set Co = DBGA.Columns(ColIndex)
    Select Case ColIndex
     Case 4
        Lssex.Left = DBGA.Left + Co.Left + Co.Width
        Lssex.Top = DBGA.Top + DBGA.RowTop(DBGA.Row)
        Lssex.Visible = True
        Lssex.ZOrder 0
        Lssex.SetFocus
    Case 7 'degree
        LsDegree.Left = DBGA.Left + Co.Left + Co.Width
        LsDegree.Top = DBGA.Top + DBGA.RowTop(DBGA.Row)
        LsDegree.Visible = True
        LsDegree.ZOrder 0
        LsDegree.SetFocus
    Case 8 'department
        LsDepart.Left = DBGA.Left + Co.Left + Co.Width
        LsDepart.Top = DBGA.Top + DBGA.RowTop(DBGA.Row)
        LsDepart.Visible = True
        LsDepart.ZOrder 0
        LsDepart.SetFocus
    End Select
End Sub
Private Sub DBGA_HeadClick(ByVal ColIndex As Integer)
    DBGA.ClearSelCols
End Sub
Private Sub DBGA_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 2 Then
        FrmMain.PopupMenu Mp
    End If
End Sub
Private Sub DBGA_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
    cuAp = DataA.Recordset.AbsolutePosition
    If cuAp > -1 Then
         DataB.Recordset.FindFirst "职工编号=" + CStr(DataA.Recordset.Fields("职工编号"))
         If DataB.Recordset.NoMatch Then
            Lab.Caption = "没有此职员"
        Else
            With DataB.Recordset
                Lab.Caption = "职工编号:" + CStr(.Fields(0)) + " 姓名:" + CStr(.Fields(1)) + " 性别:" + CStr(.Fields(4)) + " 部门:" + CStr(.Fields(8)) + " 职位:" + CStr(.Fields(9)) + " 电话:" + CStr(.Fields(11))
            End With
        End If
    End If
End Sub
Private Sub LsDegree_Click()
    If LsDegree.Text = "定制" Then
      FrmTable.Show
    Else
        DataA.Recordset.Edit
        DataA.Recordset.Fields(7) = LsDegree.Text
        DataA.Recordset.Fields(13) = CStr(frmLogin.CurId)
        DataA.Recordset.Fields(14) = CStr(Now)
        DataA.Recordset.Update
        DataB.Refresh
    End If
End Sub
Private Sub LsDepart_Click()
    If LsDepart.Text = "定制" Then
        FrmTable.Show
    Else
        DataA.Recordset.Edit
        DataA.Recordset.Fields(8) = LsDepart.Text
        DataA.Recordset.Fields(13) = CStr(frmLogin.CurId)
        DataA.Recordset.Fields(14) = CStr(Now)
        DataA.Recordset.Update
        DataB.Refresh
    End If
End Sub
Private Sub Lssex_Click()
    DataA.Recordset.Edit
    DataA.Recordset.Fields(4) = Lssex.Text
    DataA.Recordset.Fields(13) = CStr(frmLogin.CurId)
    DataA.Recordset.Fields(14) = CStr(Now)
    DataA.Recordset.Update
    DataB.Refresh
End Sub
'#################################
Private Sub Lssex_LostFocus()
    Lssex.Visible = False
End Sub
Private Sub Lsdegree_LostFocus()
    LsDegree.Visible = False
End Sub
Private Sub Lsdepart_LostFocus()
     LsDepart.Visible = False
End Sub
Private Sub DBGA_Scroll(Cancel As Integer)
    Lssex.Visible = False
    LsDegree.Visible = False
    LsDepart.Visible = False
End Sub
'#################################
Private Sub MAbout_Click()
    frmAbout.Show
End Sub
Private Sub Mhelp_Click()
    FrmHelp.Show
End Sub
Private Sub Moption_Click(Index As Integer)
    If Index = 0 Then
       If frmLogin.CurUser = "admin" Then
            FrmSys.Show
       Else
            FrmPsw.Show
            Pwin = "Frmmain"
            FrmMain.Enabled = False
       End If
    Else
        End
    End If
End Sub
Private Sub Mpop_Click(Index As Integer)
Select Case Index
    Case 1
        FrmEdit.Show
        FrmMain.Enabled = False
    Case 2
        If DBGA.SelBookmarks.Count = 1 Then
          If MsgBox("确定要删除吗?", vbOKCancel, "确定") = vbOK Then DataA.Recordset.Delete
           cuAp = 0
        Else
           MsgBox "请选择要删除的条目!"
        End If
    Case 3
        FrmSearch.Show
    End Select
End Sub
Private Sub Mtab_Click(Index As Integer)
Dim i As Integer
    For i = 0 To 2
        mtab(i).Checked = False
    Next i
    mtab(Index).Checked = True
    Select Case Index
    Case 0
         prnflag = 1
         Call showemployee
    Case 1
        prnflag = 2
        Call showleave
    Case 2
         prnflag = 3
        Call showsalary
    Case 3
       FrmTable.Show
    End Select
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  Select Case Button.Index
    Case 1 'edit
        FrmEdit.Show
        FrmMain.Enabled = False
    Case 2 'del
        If DBGA.SelBookmarks.Count = 1 Then
          If MsgBox("确定要删除吗?", vbOKCancel, "确定") = vbOK Then DataA.Recordset.Delete
           cuAp = 0
        Else
           MsgBox "请选择要删除的条目!"
        End If
    Case 3 'seek
        FrmSearch.Show
    Case 4 'setup
        FrmSetup.Show
    End Select
End Sub
Private Sub Toolbar2_ButtonClick(ByVal Button As MSComctlLib.Button)
    Select Case Button.Index
    Case 1
      prnflag = 1
      Call showemployee
    Case 2
      prnflag = 2
      Call showleave
    Case 3
       prnflag = 3
       Call showsalary
    Case 4
        If frmLogin.CurUser = "admin" Then
            FrmSys.Show
        Else
           FrmPsw.Show
           Pwin = "Frmmain"
           FrmMain.Enabled = False
        End If
   Case 5
      Unload Me
    End Select
End Sub

⌨️ 快捷键说明

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