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

📄 form3.frm

📁 小小图书管理系统是功能完善,已经可以实用于小型单位或科室的图书管理.系统界面美观,操作方便,代码带有详尽的注释,相信大家一定会喜欢
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form3 
   Appearance      =   0  'Flat
   AutoRedraw      =   -1  'True
   BackColor       =   &H80000005&
   BorderStyle     =   0  'None
   Caption         =   "职工信息录入"
   ClientHeight    =   4635
   ClientLeft      =   3480
   ClientTop       =   2880
   ClientWidth     =   8775
   LinkTopic       =   "Form3"
   LockControls    =   -1  'True
   ScaleHeight     =   309
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   585
   ShowInTaskbar   =   0   'False
   Begin Project1.xp_canvas xp_canvas1 
      Height          =   4575
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   8775
      _ExtentX        =   15478
      _ExtentY        =   8070
      Caption         =   "职工信息录入"
      Icon            =   "Form3.frx":0000
      Begin VB.Frame Frame1 
         Height          =   3015
         Left            =   360
         TabIndex        =   6
         Top             =   600
         Width           =   8055
         Begin VB.TextBox Text1 
            Height          =   375
            Left            =   1320
            TabIndex        =   11
            Top             =   480
            Width           =   2055
         End
         Begin VB.TextBox Text2 
            Height          =   375
            Left            =   4920
            TabIndex        =   10
            Top             =   480
            Width           =   2055
         End
         Begin VB.TextBox Text3 
            Height          =   375
            Left            =   1320
            TabIndex        =   9
            Top             =   1200
            Width           =   2055
         End
         Begin VB.TextBox Text4 
            Height          =   375
            Left            =   4920
            TabIndex        =   8
            Top             =   1200
            Width           =   2055
         End
         Begin VB.TextBox Text5 
            Height          =   375
            Left            =   1320
            TabIndex        =   7
            Top             =   2040
            Width           =   5655
         End
         Begin VB.Label Label2 
            Caption         =   " 姓   名"
            Height          =   255
            Left            =   3720
            TabIndex        =   16
            Top             =   540
            Width           =   975
         End
         Begin VB.Label Label4 
            Caption         =   "联系电话"
            Height          =   255
            Left            =   3720
            TabIndex        =   15
            Top             =   1260
            Width           =   975
         End
         Begin VB.Label Label1 
            Caption         =   "职工编号"
            Height          =   255
            Left            =   240
            TabIndex        =   14
            Top             =   540
            Width           =   975
         End
         Begin VB.Label Label3 
            Caption         =   "性     别"
            Height          =   255
            Left            =   240
            TabIndex        =   13
            Top             =   1260
            Width           =   975
         End
         Begin VB.Label Label5 
            Caption         =   "家庭住址"
            Height          =   255
            Left            =   240
            TabIndex        =   12
            Top             =   2100
            Width           =   975
         End
      End
      Begin Project1.xpcmdbutton Command5 
         Height          =   375
         Left            =   6240
         TabIndex        =   5
         Top             =   3840
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         Caption         =   "退出"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin Project1.xpcmdbutton Command4 
         Height          =   375
         Left            =   4680
         TabIndex        =   4
         Top             =   3840
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         Caption         =   "下一记录"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin Project1.xpcmdbutton Command3 
         Height          =   375
         Left            =   3240
         TabIndex        =   3
         Top             =   3840
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         Caption         =   "上一记录"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin Project1.xpcmdbutton Command2 
         Height          =   375
         Left            =   1800
         TabIndex        =   2
         Top             =   3840
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         Caption         =   "删除记录"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin Project1.xpcmdbutton Command1 
         Height          =   375
         Left            =   480
         TabIndex        =   1
         Top             =   3840
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         Caption         =   "添加记录"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
      End
      Begin Project1.xptopbuttons xptopbuttons2 
         Height          =   315
         Left            =   8040
         Top             =   120
         Width           =   315
         _ExtentX        =   556
         _ExtentY        =   556
         Value           =   2
      End
      Begin Project1.xptopbuttons xptopbuttons1 
         Height          =   315
         Left            =   8400
         Top             =   120
         Width           =   315
         _ExtentX        =   556
         _ExtentY        =   556
      End
   End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*******************************************
'        “ 员工信息管理窗体“
'  此窗体主要功能:员工信息录入、删除、修改、逐条浏览
'  员工号为主键,添加时一定要检测数据库中是否已经存在
'
'作者:朱宏梅
'制作日期: 2004-5-30
'********************************************
Option Explicit

Private Sub Command1_Click()               '添加记录
Dim sql As String
Dim param As ADODB.Parameter
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
Set param = New ADODB.Parameter
sql = "select * from worker where [工号]= ? "

If Command1.Caption = "添加记录" Then
   Command1.Caption = "确   定"
   Command2.Enabled = False
   Command3.Enabled = False
   Command4.Enabled = False
   rst.AddNew
Else
    If Text1.Text = "" Then
     frmMsg.Show
   frmMsg.notice.Visible = True
  frmMsg.Text1.Text = "职工编号不能为空!"
      Command2.Enabled = True
       Command3.Enabled = True
       Command4.Enabled = True
       Command1.Caption = "添加记录"
      Exit Sub
     End If
    With param
    .Direction = adParamInput
    .Type = adBSTR
    .Size = 8
    .Value = Text1.Text
    End With
   cmd.Parameters.Append param
   cmd.CommandText = sql
   cmd.CommandType = adCmdText
   Set cmd.ActiveConnection = con
   Set rst1 = cmd.Execute
  '检测职工编号是否存在防止主键冲突
  If rst1.RecordCount > 0 Then
     frmMsg.Show
     frmMsg.notice.Visible = True
     frmMsg.Text1.Text = "此职工编号已经存在!"
       rst.Cancel
       Command2.Enabled = True
       Command3.Enabled = True
       Command4.Enabled = True
       Command1.Caption = "添加记录"
      
       Exit Sub
   End If
   rst.Update
    Command2.Enabled = True
    Command3.Enabled = True
    Command4.Enabled = True
   
   Command1.Caption = "添加记录"
End If
End Sub

Private Sub Command2_Click()                '删除纪录
Dim ans As String
ans = Msgbox("确定要删除此记录吗?", vbYesNo, "提示")
If ans = vbYes Then
   rst.Delete
   rst.Requery
Else
 Exit Sub
End If
End Sub

Private Sub Command3_Click()                  '上一记录
If rst.BOF Then
   frmMsg.Show
   frmMsg.info.Visible = True
  frmMsg.Text1.Text = "已经到达记录顶端!"
   Exit Sub
 Else
  rst.MovePrevious
End If
End Sub

Private Sub Command4_Click()                  '下一记录
If rst.EOF Then
  frmMsg.Show
  frmMsg.info.Visible = True
  frmMsg.Text1.Text = "已经到达记录底端! "
   Exit Sub
 Else
   rst.MoveNext
End If
End Sub

Private Sub Command5_Click()
Unload Me
End Sub

Private Sub Form_Load()
Dim sql1 As String
Set rst = New ADODB.Recordset
sql1 = "select * from worker"
'打开数据库并对窗体控件赋值
Call connect_db
rst.Open sql1, con, adOpenDynamic, adLockOptimistic
Set Text1.DataSource = rst
Set Text2.DataSource = rst
Set Text3.DataSource = rst
Set Text4.DataSource = rst
Set Text5.DataSource = rst
Text1.DataField = "工号"
Text2.DataField = "姓名"
Text3.DataField = "性别"
Text4.DataField = "电话"
Text5.DataField = "住址"
End Sub




Private Sub xptopbuttons1_Click()
Unload Me
End Sub

Private Sub xptopbuttons2_Click()
Me.WindowState = 1
End Sub



⌨️ 快捷键说明

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