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

📄 form1.frm

📁 本人长期从事人事管理工作
💻 FRM
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Form1 
   Caption         =   "人事信息管理系统"
   ClientHeight    =   7575
   ClientLeft      =   165
   ClientTop       =   855
   ClientWidth     =   10080
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   7575
   ScaleWidth      =   10080
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command9 
      Caption         =   "Command9"
      Height          =   495
      Left            =   4200
      TabIndex        =   1
      Top             =   6960
      Visible         =   0   'False
      Width           =   1575
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   405
      Left            =   6120
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   7080
      Visible         =   0   'False
      Width           =   1140
   End
   Begin MSDBGrid.DBGrid DBGrid1 
      Bindings        =   "Form1.frx":08CA
      Height          =   5895
      Left            =   120
      OleObjectBlob   =   "Form1.frx":08DE
      TabIndex        =   0
      Top             =   960
      Width           =   9855
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   855
      Left            =   0
      TabIndex        =   4
      Top             =   0
      Width           =   10080
      _ExtentX        =   17780
      _ExtentY        =   1508
      ButtonWidth     =   1032
      ButtonHeight    =   1349
      Appearance      =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   7
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "添加"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "修改"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "删除"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "打印"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "设置"
            ImageIndex      =   5
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "查找"
            ImageIndex      =   6
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "退出"
            ImageIndex      =   7
         EndProperty
      EndProperty
      Begin MSComctlLib.ImageList ImageList1 
         Left            =   6240
         Top             =   120
         _ExtentX        =   1005
         _ExtentY        =   1005
         BackColor       =   -2147483643
         ImageWidth      =   32
         ImageHeight     =   32
         MaskColor       =   12632256
         _Version        =   393216
         BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
            NumListImages   =   7
            BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "Form1.frx":1961
               Key             =   ""
            EndProperty
            BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "Form1.frx":201D
               Key             =   ""
            EndProperty
            BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "Form1.frx":2AE7
               Key             =   ""
            EndProperty
            BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "Form1.frx":3A69
               Key             =   ""
            EndProperty
            BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "Form1.frx":447B
               Key             =   ""
            EndProperty
            BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "Form1.frx":48CD
               Key             =   ""
            EndProperty
            BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "Form1.frx":707F
               Key             =   ""
            EndProperty
         EndProperty
      End
   End
   Begin VB.Label Label2 
      Height          =   255
      Left            =   1920
      TabIndex        =   3
      Top             =   7080
      Width           =   495
   End
   Begin VB.Label Label1 
      Caption         =   "目前记录条数:"
      Height          =   255
      Left            =   480
      TabIndex        =   2
      Top             =   7080
      Width           =   1455
   End
   Begin VB.Menu tianjia 
      Caption         =   "添加人事信息"
   End
   Begin VB.Menu xg 
      Caption         =   "修改人事信息"
   End
   Begin VB.Menu sc 
      Caption         =   "删除人事信息"
   End
   Begin VB.Menu prnout 
      Caption         =   "打印/导出"
   End
   Begin VB.Menu bmsz 
      Caption         =   "部门信息设置"
   End
   Begin VB.Menu cx 
      Caption         =   "查询人事信息"
   End
   Begin VB.Menu exit 
      Caption         =   "退出"
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub bmsz_Click()
Form3.Show
End Sub
Private Sub Command9_Click()

Dim n As Long

If Command9.Caption = "修改" Then        '进行修改操作
       
  Form2.Show                            '打开FRMNEW窗口
    
  Form2.Data1.Recordset.FindFirst "员工编号 ='" & DBGrid1.Text & "'"
  
  Form2.Data1.Recordset.Edit
    
End If

If Command9.Caption = "删除" Then         '进行删除操作

   
  Form2.Data1.Recordset.FindFirst "员工编号 ='" & DBGrid1.Text & "'"
   
  ss = MsgBox("真得要删除这条记录?", vbYesNo + vbInformation, "删除记录")

  If (ss = vbYes) Then                    '删除
  
  Select Case Data1.Recordset.RecordCount
  Case 1                                  '如果只有一条记录,则在删除后使“删除”键消失
     Data1.Recordset.Delete
     Command9.Visible = False
  Case Is > 1                             '如果多于一条记录
     Data1.Recordset.Delete
     
     If Data1.Recordset.EOF Then          '如果指针在最后一条记录
                                          '!该判断有问题,当删除指针指向的最下方记录后,dbgrid中看不到指针。但不影响功能!
        Data1.Recordset.MovePrevious          '指针向前移动
        Else: Data1.Recordset.MoveNext       '否则向后移动
     End If
     
  End Select
       
  End If
   

   n = Data1.Recordset.RecordCount

   Label2.Caption = "" & n & ""
   
   
End If
End Sub

Private Sub cx_Click()
Form4.Show
End Sub

Private Sub exit_Click()
Unload Me
End

End Sub

Private Sub Form_Activate()

Dim n As Long

n = Data1.Recordset.RecordCount

Label2.Caption = "" & n & ""

End Sub

Private Sub Form_Load()

Data1.DatabaseName = App.Path & "\mang.mdb"

Data1.RecordSource = "mang"

End Sub

Private Sub prnout_Click()
If Data1.Recordset.BOF And Data1.Recordset.EOF Then

MsgBox "没有查询结果,无法打印!"

Exit Sub

End If

Form5.Show
End Sub

Private Sub sc_Click()
If (Data1.Recordset.BOF) And (Data1.Recordset.EOF) Then '检查记录集中是否有数据。
      MsgBox ("数据库中没有记录")
Else
 '显示command9按键,并将CAPTION属性定义为“删除”
  Command9.Visible = True
  Command9.Caption = "删除"
  End If
End Sub

Private Sub tianjia_Click()
Form2.Show  '显示增加窗口

Form2.Data1.Recordset.AddNew   '增加数据
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1
Form2.Show  '显示增加窗口
Form2.Data1.Recordset.AddNew   '增加数据
Case 2
If (Data1.Recordset.BOF) And (Data1.Recordset.EOF) Then '检查记录集中是否有数据。
      MsgBox ("数据库中没有记录")
 Else
 '显示command9按键,并将CAPTION属性定义为“修改”
  Command9.Visible = True
  Command9.Caption = "修改"
End If
Case 3
If (Data1.Recordset.BOF) And (Data1.Recordset.EOF) Then '检查记录集中是否有数据。
      MsgBox ("数据库中没有记录")
Else
 '显示command9按键,并将CAPTION属性定义为“删除”
  Command9.Visible = True
  Command9.Caption = "删除"
  End If
Case 4
If Data1.Recordset.BOF And Data1.Recordset.EOF Then
MsgBox "没有查询结果,无法打印!"
Exit Sub
End If
Form5.Show
Case 5
Form3.Show
Case 6
Form4.Show
Case 7
If MsgBox("真的要对出本系统吗?", vbQuestion + vbYesNo + vbDefaultButton2, "退出") = vbNo Then
    Cancel = 1
    Else
End
End If
End Select
End Sub

Private Sub xg_Click()
If (Data1.Recordset.BOF) And (Data1.Recordset.EOF) Then '检查记录集中是否有数据。
      MsgBox ("数据库中没有记录")
 Else
 '显示command9按键,并将CAPTION属性定义为“修改”
  Command9.Visible = True
  Command9.Caption = "修改"
End If
End Sub

⌨️ 快捷键说明

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