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

📄 data.frm

📁 一个使用vb编写的人事管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Data 
   Caption         =   "职工信息管理"
   ClientHeight    =   4800
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5655
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   10.5
      Charset         =   134
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   4800
   ScaleWidth      =   5655
   WindowState     =   2  'Maximized
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   495
      Left            =   1920
      Top             =   4200
      Visible         =   0   'False
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   873
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   2
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=RSGL.mdb"
      OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=RSGL.mdb"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "EMP"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton Command8 
      Caption         =   "最后一个"
      Height          =   495
      Left            =   3960
      TabIndex        =   25
      Top             =   2760
      Width           =   1215
   End
   Begin VB.CommandButton Command7 
      Caption         =   "下一个"
      Height          =   495
      Left            =   3960
      TabIndex        =   24
      Top             =   2040
      Width           =   1215
   End
   Begin VB.CommandButton Command6 
      Caption         =   "上一个"
      Height          =   495
      Left            =   3960
      TabIndex        =   23
      Top             =   1320
      Width           =   1215
   End
   Begin VB.CommandButton Command5 
      Caption         =   "第一个"
      Height          =   495
      Left            =   3960
      TabIndex        =   22
      Top             =   600
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      Caption         =   "退出"
      Height          =   495
      Left            =   3960
      TabIndex        =   21
      Top             =   3720
      Width           =   1215
   End
   Begin VB.CommandButton Command3 
      Caption         =   "删除"
      Height          =   495
      Left            =   2760
      TabIndex        =   20
      Top             =   3720
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "修改"
      Height          =   495
      Left            =   1560
      TabIndex        =   19
      Top             =   3720
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加"
      Height          =   495
      Left            =   360
      TabIndex        =   18
      Top             =   3720
      Width           =   1215
   End
   Begin VB.TextBox Text9 
      DataField       =   "基本工资"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   17
      Top             =   3120
      Width           =   1935
   End
   Begin VB.TextBox Text8 
      DataField       =   "所在部门"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   16
      Top             =   2760
      Width           =   1935
   End
   Begin VB.TextBox Text7 
      DataField       =   "技术职称"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   15
      Top             =   2400
      Width           =   1935
   End
   Begin VB.TextBox Text6 
      DataField       =   "工作时间"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   14
      Top             =   2040
      Width           =   1935
   End
   Begin VB.TextBox Text5 
      DataField       =   "婚姻状况"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   13
      Top             =   1680
      Width           =   1935
   End
   Begin VB.TextBox Text4 
      DataField       =   "职工性别"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   12
      Top             =   1320
      Width           =   1935
   End
   Begin VB.TextBox Text3 
      DataField       =   "职工年龄"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   11
      Top             =   960
      Width           =   1935
   End
   Begin VB.TextBox Text2 
      DataField       =   "职工姓名"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   10
      Top             =   600
      Width           =   1935
   End
   Begin VB.TextBox Text1 
      DataField       =   "职工编号"
      DataSource      =   "Adodc1"
      Height          =   375
      Left            =   1320
      TabIndex        =   9
      Top             =   240
      Width           =   1935
   End
   Begin VB.Label Label9 
      AutoSize        =   -1  'True
      Caption         =   "基本工资"
      Height          =   210
      Left            =   360
      TabIndex        =   8
      Top             =   3240
      Width           =   915
   End
   Begin VB.Label Label8 
      AutoSize        =   -1  'True
      Caption         =   "所在部门"
      Height          =   210
      Left            =   360
      TabIndex        =   7
      Top             =   2880
      Width           =   915
   End
   Begin VB.Label Label7 
      AutoSize        =   -1  'True
      Caption         =   "技术职称"
      Height          =   210
      Left            =   360
      TabIndex        =   6
      Top             =   2520
      Width           =   915
   End
   Begin VB.Label Label6 
      AutoSize        =   -1  'True
      Caption         =   "工作时间"
      Height          =   210
      Left            =   360
      TabIndex        =   5
      Top             =   2160
      Width           =   915
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      Caption         =   "婚姻状况"
      Height          =   210
      Left            =   360
      TabIndex        =   4
      Top             =   1800
      Width           =   915
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "职工性别"
      Height          =   210
      Left            =   360
      TabIndex        =   3
      Top             =   1440
      Width           =   915
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "职工年龄"
      Height          =   210
      Left            =   360
      TabIndex        =   2
      Top             =   1080
      Width           =   915
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "职工姓名"
      Height          =   210
      Left            =   360
      TabIndex        =   1
      Top             =   720
      Width           =   915
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "职工编号"
      Height          =   210
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   915
   End
End
Attribute VB_Name = "Data"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim Mode As String

Sub NoEdit()
 Text1.Locked = True
 Text2.Locked = True
 Text3.Locked = True
 Text4.Locked = True
 Text5.Locked = True
 Text6.Locked = True
 Text7.Locked = True
 Text8.Locked = True
 Text9.Locked = True
 
End Sub


Sub CanEdit()
Text1.Locked = False
Text2.Locked = False
Text3.Locked = False
Text4.Locked = False
Text5.Locked = False
Text6.Locked = False
Text7.Locked = False
Text8.Locked = False
Text9.Locked = False

End Sub

'Sub ShowInfo()
'Text1.Text = adodc1.recordset.Fields("职工编号")
'Text2.Text = adodc1.recordset.Fields("职工姓名")
'Text3.Text = adodc1.recordset.Fields("职工年龄")
'Text4.Text = adodc1.recordset.Fields("职工性别")
'Text5.Text = adodc1.recordset.Fields("婚姻状况")
'Text6.Text = adodc1.recordset.Fields("工作时间")
'Text7.Text = adodc1.recordset.Fields("技术职称")
'Text8.Text = adodc1.recordset.Fields("所在部门")
'Text9.Text = adodc1.recordset.Fields("基本工资")
'End Sub
Private Sub Command1_Click()
    Mode = "add"
   
    Adodc1.Recordset.AddNew
    Call CanEdit

End Sub

Private Sub Command2_Click()

    Mode = "modify"
    Call CanEdit
End Sub

Private Sub Command3_Click()
    Dim Del As Integer
    
    '正在添加或修改的记录不能删除
    If Mode = "add" Or Mode = "modify" Then
      MsgBox "不能删除记录"
      Exit Sub
    End If
    
    Del = MsgBox("are u sure?", vbOKCancel, "MIS")
    
    '单击“取消”按钮,不做任何处理
    If Del <> 1 Then Exit Sub
    Adodc1.Recordset.Delete
    Adodc1.Recordset.MoveNext
    If Adodc1.Recordset.EOF Then Adodc1.Recordset.MoveLast
    
    Call NoEdit
    
    Mode = "view"
End Sub

Private Sub Command4_Click()
'Adodc1.Recordset.MoveLast
'Adodc1.Refresh
If Mode = "add" Or Mode = "modify" Then Adodc1.Recordset.Update
Unload Me
End Sub

Private Sub Command5_Click()

If Mode = "add" Or Mode = "modify" Then
  If Text1.Text = "" Or Text2.Text = "" _
          Or Text3.Text = "" Or Text4.Text = "" _
          Or Text5.Text = "" Or Text6.Text = "" _
          Or Text7.Text = "" Or Text8.Text = "" _
          Or Text9.Text = "" Then
     MsgBox "请输入所有要求的数据", , "输入错误"
     Exit Sub
  End If

Call NoEdit
Mode = "view"
End If

Adodc1.Recordset.MoveFirst
'call showinfo
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = True
Command8.Enabled = True

End Sub

Private Sub Command6_Click()

If Mode = "add" Or Mode = "modify" Then
  If Text1.Text = "" Or Text2.Text = "" _
          Or Text3.Text = "" Or Text4.Text = "" _
          Or Text5.Text = "" Or Text6.Text = "" _
          Or Text7.Text = "" Or Text8.Text = "" _
          Or Text9.Text = "" Then
     MsgBox "请输入所有要求的数据", , "输入错误"
     Exit Sub
  End If

Call NoEdit
Mode = "view"
End If

If Not Adodc1.Recordset.BOF Then
  Adodc1.Recordset.MovePrevious
  If Adodc1.Recordset.BOF Then
    Adodc1.Recordset.MoveFirst
    Command5.Enabled = False
    Command6.Enabled = False
  End If
Else
  Adodc1.Recordset.MoveFirst
  
  
  Command5.Enabled = False
  Command6.Enabled = False
End If
  
  'call showinfo
  Command7.Enabled = True
  Command8.Enabled = True

End Sub

Private Sub Command7_Click()
'============================================
'按下“下一个”按钮,判断是否“添加”或“修改”状态
'如果是,不能有空数据,否则,提示错误并退出本过程。
'如果操作正确,则设置控件不可编辑,
'显示下一条记录,并进行相应处理
'============================================

If Mode = "add" Or Mode = "modify" Then

'如果单击了“添加”或“修改”,判断数据是否完整
  If Text1.Text = "" Or Text2.Text = "" _
          Or Text3.Text = "" Or Text4.Text = "" _
          Or Text5.Text = "" Or Text6.Text = "" _
          Or Text7.Text = "" Or Text8.Text = "" _
          Or Text9.Text = "" Then
       MsgBox "请输入所有要求的数据", , "输入错误"
       Exit Sub
  End If

'设置其他控件不可编辑
Call NoEdit
Mode = "view"
End If

'移动记录指针,并设置相应按钮的状态
If Not Adodc1.Recordset.EOF Then
  Adodc1.Recordset.MoveNext
  
  '如果移动指针到文件尾,显示最后一条记录,并
  '设置“下一个”和“最后一个”按钮不可用
  If Adodc1.Recordset.EOF Then
    Adodc1.Recordset.MoveLast
    Command7.Enabled = False
    Command8.Enabled = False
  End If
Else
  '如果当前为文件尾,显示最后一条记录,并
  '设置“下一个”和“最后一个”按钮不可用
  Adodc1.Recordset.MoveLast
  
  Command7.Enabled = False
  Command8.Enabled = False
End If
'call showinfo

Command5.Enabled = True
Command6.Enabled = True
End Sub

Private Sub Command8_Click()

    If Mode = "add" Or Mode = "modify" Then
  If Text1.Text = "" Or Text2.Text = "" _
          Or Text3.Text = "" Or Text4.Text = "" _
          Or Text5.Text = "" Or Text6.Text = "" _
          Or Text7.Text = "" Or Text8.Text = "" _
          Or Text9.Text = "" Then
         MsgBox "请输入所有要求的数据", , "输入错误"
         Exit Sub
      End If
        
    Call NoEdit
    Mode = "view"
    End If
    
    Command5.Enabled = True
    Command6.Enabled = True
    Command7.Enabled = False
    Command8.Enabled = False
    Adodc1.Recordset.MoveLast
    'call showinfo
End Sub

Private Sub Form_Load()
    
    Set ADORst = New Recordset
    ADORst.Open "select * from emp ", DB, adOpenStatic, adLockOptimistic
    ADORst.MoveFirst
    Call NoEdit
End Sub

⌨️ 快捷键说明

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