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

📄 form1.frm

📁 VB6.0+ACCE
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmMain 
   Caption         =   "简易公司员工信息管理系统"
   ClientHeight    =   4515
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6870
   LinkTopic       =   "Form1"
   ScaleHeight     =   4515
   ScaleWidth      =   6870
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command5 
      Caption         =   "通过数据网格浏览"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4080
      TabIndex        =   18
      Top             =   3120
      Width           =   2295
   End
   Begin VB.CommandButton Command2 
      Caption         =   "查找"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Index           =   3
      Left            =   3360
      TabIndex        =   17
      Top             =   3600
      Width           =   735
   End
   Begin VB.CommandButton Command4 
      Caption         =   "清空"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   4200
      TabIndex        =   16
      Top             =   3600
      Width           =   735
   End
   Begin VB.CommandButton Command3 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   5160
      TabIndex        =   15
      Top             =   3600
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "删除记录"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Index           =   2
      Left            =   2400
      TabIndex        =   14
      Top             =   3600
      Width           =   735
   End
   Begin VB.CommandButton Command2 
      Caption         =   "修改记录"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Index           =   1
      Left            =   1440
      TabIndex        =   13
      Top             =   3600
      Width           =   735
   End
   Begin VB.CommandButton Command2 
      Caption         =   "添加记录"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Index           =   0
      Left            =   480
      TabIndex        =   12
      Top             =   3600
      Width           =   735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "最后"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   3
      Left            =   3120
      TabIndex        =   11
      Top             =   3120
      Width           =   735
   End
   Begin VB.CommandButton Command1 
      Caption         =   "前一条"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   2
      Left            =   2160
      TabIndex        =   10
      Top             =   3120
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "下一条"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   1
      Left            =   1200
      TabIndex        =   9
      Top             =   3120
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "开始"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   0
      Left            =   480
      TabIndex        =   8
      Top             =   3120
      Width           =   735
   End
   Begin VB.TextBox Text3 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1455
      Left            =   360
      ScrollBars      =   1  'Horizontal
      TabIndex        =   7
      Top             =   1320
      Width           =   6135
   End
   Begin VB.TextBox Text2 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   5760
      TabIndex        =   6
      Top             =   240
      Width           =   735
   End
   Begin VB.ComboBox Combo1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      ItemData        =   "Form1.frx":0000
      Left            =   3840
      List            =   "Form1.frx":000A
      TabIndex        =   5
      Top             =   240
      Width           =   735
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1200
      TabIndex        =   4
      Top             =   240
      Width           =   1335
   End
   Begin VB.Line Line1 
      X1              =   0
      X2              =   6720
      Y1              =   3000
      Y2              =   3000
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "个人简历:"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   480
      TabIndex        =   3
      Top             =   840
      Width           =   1500
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      Caption         =   "年龄:"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   4800
      TabIndex        =   2
      Top             =   240
      Width           =   900
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      Caption         =   "性别:"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   2880
      TabIndex        =   1
      Top             =   240
      Width           =   900
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "姓名:"
      BeginProperty Font 
         Name            =   "黑体"
         Size            =   15
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   900
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click(Index As Integer)
  Select Case Index
         Case 0
                 rs.MoveFirst
                 Call SeeYou
                  MsgBox "已经是第一条记录了!"
         Case 1
              rs.MoveNext
              If rs.EOF = True Then
                 MsgBox "已经是最后一条记录了!"
                 rs.MoveLast
              Else
                 Call SeeYou
              End If
         Case 2
              rs.MovePrevious
              If rs.BOF = True Then
                 MsgBox "已经是第一条记录了!"
                 rs.MoveFirst
                 Call SeeYou
              Else
                 Call SeeYou
              End If
         Case 3
                 rs.MoveLast
                 Call SeeYou
                 MsgBox "已经是最后一条记录了!"
           
  End Select
End Sub

Private Sub Command2_Click(Index As Integer)
  Select Case Index
         Case 0
            rs.AddNew
            rs.Fields("name") = Text1.Text
            rs.Fields("sex") = Combo1.Text
            rs.Fields("age") = Text2.Text
            rs.Fields("per") = Text3.Text
            rs.Update
            MsgBox "OK,成功这条添加记录了"
            Set rs = td.OpenRecordset '打开更新了的数据集
            Call SeeYouNothing
            
         Case 1
            rs.Edit
            rs.Fields("name") = Text1.Text
            rs.Fields("sex") = Combo1.Text
            rs.Fields("age") = Text2.Text
            rs.Fields("per") = Text3.Text
            rs.Update
            MsgBox "OK,成功更新这条记录了"
         Case 2
            rs.Delete
            MsgBox "OK,成功删除这条记录了"
            Set rs = td.OpenRecordset '打开更新了的数据集
            Call SeeYouNothing
         Case 3
            Dim NameFind As String
            NameFind = InputBox("请输入你要查询的人名", "", "")
            Set fd = rs.Fields("name")
            rs.MoveFirst
Find01:
            If rs.EOF = True Then
                MsgBox "查无此记录"
            Else
               If Trim(NameFind) = fd Then
                  Call SeeYou
                  GoTo FindEnd01
               End If
               rs.MoveNext
               GoTo Find01
            End If
FindEnd01:
  End Select
End Sub
Private Sub Command3_Click()
    End
End Sub
Private Sub Command4_Click()
    Call SeeYouNothing
End Sub

Private Sub Command5_Click()
  frmMSFlexGrid.Show
  Unload Me
End Sub

Private Sub Form_Load()
    Dim strDBName As String
    strDBName = App.Path & "\Person.mdb" '取得打开的数据库名
    Set db = DBEngine(0).OpenDatabase(strDBName) '打开这个数据库
    Set tds = db.TableDefs   '定义数据表集合
    Set td = tds("Man")  '设定数据表为Man
    Set rs = td.OpenRecordset '打开数据集
       
    '初始数据库第一条记录显示出来
    If rs.EOF = False Then
       rs.MoveFirst '移动到记录集的第一条记录的位置
       Text1.Text = rs.Fields("name")
       Combo1.Text = rs.Fields("sex")
       Text2.Text = rs.Fields("age")
       Text3.Text = rs.Fields("per")
    Else
       MsgBox "对不起,你数据库的记录为空。请添加记录!"
    End If
    
    '使用DBEngine的Version属性可以提供DAO的版本.
    MsgBox "DAO的版本是" & DBEngine.Version
End Sub
Sub SeeYou()   '将记录内容显示到文本框中
       Text1.Text = rs.Fields("name")
       Combo1.Text = rs.Fields("sex")
       Text2.Text = rs.Fields("age")
       Text3.Text = rs.Fields("per")
End Sub
Sub SeeYouNothing()   '将记录内容显示到文本框中
       Text1.Text = ""
       Combo1.Text = ""
       Text2.Text = ""
       Text3.Text = ""
End Sub


⌨️ 快捷键说明

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