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

📄 工作人员信息.frm

📁 小区物业管理系统vb开发的,曾用于本科毕业设计
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      End
      Begin VB.Label Label1 
         BackColor       =   &H00C0E0FF&
         Caption         =   "编号:"
         Height          =   255
         Left            =   480
         TabIndex        =   6
         Top             =   480
         Width           =   615
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00C0E0FF&
      Caption         =   "选择工种"
      Height          =   975
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   6615
      Begin VB.OptionButton Option4 
         BackColor       =   &H00C0E0FF&
         Caption         =   "维修人员"
         Height          =   255
         Left            =   5040
         TabIndex        =   5
         TabStop         =   0   'False
         Top             =   360
         Width           =   1215
      End
      Begin VB.OptionButton Option3 
         BackColor       =   &H00C0E0FF&
         Caption         =   "保安人员"
         Height          =   300
         Left            =   3360
         TabIndex        =   4
         TabStop         =   0   'False
         Top             =   360
         Width           =   1215
      End
      Begin VB.OptionButton Option2 
         BackColor       =   &H00C0E0FF&
         Caption         =   "消防工人"
         Height          =   255
         Left            =   1800
         TabIndex        =   3
         TabStop         =   0   'False
         Top             =   360
         Width           =   1215
      End
      Begin VB.OptionButton Option1 
         BackColor       =   &H00C0E0FF&
         Caption         =   "清洁工人"
         Height          =   255
         Left            =   240
         TabIndex        =   2
         TabStop         =   0   'False
         Top             =   360
         Width           =   1455
      End
   End
   Begin MSAdodcLib.Adodc Adodc2 
      Height          =   375
      Left            =   1440
      Top             =   2040
      Visible         =   0   'False
      Width           =   1935
      _ExtentX        =   3413
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=物业管理系统;Data Source=(local)"
      OLEDBString     =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=物业管理系统;Data Source=(local)"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "select *  from 小区工作人员信息"
      Caption         =   "Adodc2"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   3480
      Top             =   2040
      Visible         =   0   'False
      Width           =   1935
      _ExtentX        =   3413
      _ExtentY        =   661
      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=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=物业管理系统;Data Source=(local)"
      OLEDBString     =   "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=物业管理系统;Data Source=(local)"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "小区工作人员信息"
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSDataListLib.DataCombo DataCombo1 
      Bindings        =   "工作人员信息.frx":56B9
      Height          =   330
      Left            =   240
      TabIndex        =   24
      Top             =   2040
      Visible         =   0   'False
      Width           =   1215
      _ExtentX        =   2143
      _ExtentY        =   582
      _Version        =   393216
      ListField       =   "工种"
      Text            =   "DataCombo1"
   End
End
Attribute VB_Name = "工作人员信息"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim isadding As Boolean
Dim objcn As Connection
Dim objman As Recordset
'添加记录
Private Sub Cmdadd_Click()
 MsgBox "请输入员工资料!", vbInformation, "温馨提示"
 Text1.Text = ""
 Combo1.Text = ""
 Text2.Text = ""
 Combo2.Text = ""
 Text4.Text = ""
 isadding = True
 DTP1.Enabled = True
 DTP2.Enabled = True
 Cmdsave.Enabled = True
 Cmdback.Enabled = True
End Sub

Private Sub Cmdback_Click()
If isadding = True Then
   MsgBox "是否放弃添加记录?", vbQuestion, "温馨提示"
   Adodc2.Recordset.CancelBatch
   Adodc2.Recordset.Requery
   isadding = False
   DTP1.Enabled = False
   DTP2.Enabled = False
   Cmdsave.Enabled = False
   Cmdback.Enabled = False
End If
End Sub

'删除记录
Private Sub Cmddelete_Click()
If isadding = True Then
   MsgBox "当前为状态为添加记录状态,不能删除记录"
   Adodc2.Recordset.CancelBatch                     '显示当前记录
Else
  If MsgBox("是否要删除当前记录?", vbYesNo + vbQuestion, "温馨提示") = vbYes Then
     Adodc2.Recordset.Delete
     Adodc2.Recordset.Requery
  End If
End If
End Sub


Private Sub Cmdexit_Click()
物业管理系统.Show
Unload Me
End Sub

'保存信息
Private Sub Cmdsave_Click()

With objman
If Text1.Text = "" Then
   MsgBox "请输入编号!", vbInformation, "温馨提示"
   Text1.SetFocus
   Text1.Text = ""
   Exit Sub
End If
If Combo1.Text = "" Then
   MsgBox "请选择工种!", vbInformation, "温馨提示"
   Combo1.SetFocus
   Exit Sub
End If
If Trim(Text2.Text) = "" Then
   MsgBox "请输入姓名!", vbInformation, "温馨提示"
   Text2.SetFocus
   Exit Sub
End If
'检查代码是否重复
Dim objcopy As New Recordset
Set objcopy = objman.Clone
If objcopy.RecordCount > 0 Then
   objcopy.MoveFirst
   objcopy.Find "编号='" & Trim(Text1.Text) & "'"
   If (isadding And Not objcopy.EOF) Or (Not isadding And Not objcopy.EOF And objcopy.AbsolutePosition <> objman.AbsolutePosition) Then
       MsgBox "编号已被使用!", vbCritical, "温馨提示"
       Text1.SetFocus
       Text1.SelStart = 0
       Exit Sub
    Else
       If isadding Then objman.AddNew
           .Fields("编号") = Trim(Text1.Text)
           .Fields("工种") = Trim(Combo1.Text)
           .Fields("姓名") = Trim(Text2.Text)
           .Fields("出生年月") = Trim(DTP1.Value)
           .Fields("性别") = Trim(Combo2.Text)
           .Fields("联系方式") = Trim(Text4.Text)
           .Fields("参加工作时间") = Trim(DTP2.Value)
           objman.Update
          MsgBox "数据保存成功!", vbInformation, "温馨提示"
          isadding = False
           Text1.Text = ""
           Combo1.Text = ""
           Text2.Text = ""
           Combo2.Text = ""
           Text4.Text = ""
           DTP1.Enabled = False
           DTP2.Enabled = False
           Cmdsave.Enabled = False
           Cmdback.Enabled = False
    End If
 Else
   If isadding Then
       .AddNew
       .Fields("编号") = Trim(Text1.Text)
       .Fields("工种") = Trim(Combo1.Text)
       .Fields("姓名") = Trim(Text2.Text)
       .Fields("出生年月") = Trim(DTP1.Value)
       .Fields("性别") = Trim(Combo2.Text)
       .Fields("联系方式") = Trim(Text4.Text)
       .Fields("参加工作时间") = Trim(DTP2.Value)
       .Update
       MsgBox "数据保存成功!", vbInformation, "温馨提示"
       isadding = False
        Text1.Text = ""
        Combo1.Text = ""
        Text2.Text = ""
        Combo2.Text = ""
        Text4.Text = ""
        DTP1.Enabled = False
        DTP2.Enabled = False
        Cmdsave.Enabled = False
        Cmdback.Enabled = False
    End If
End If
End With
Adodc2.Refresh
End Sub

Private Sub Form_Load()
DTP1.Enabled = False
DTP2.Enabled = False
Cmdsave.Enabled = False
Cmdback.Enabled = False

 '建立数据库联接
    Set objcn = New Connection                 '实例化联接对象
    With objcn                                 '建立数据库联接
        .Provider = "SQLOLEDB"
        .ConnectionString = "User ID=sa;PWD=sa;Data Source=(local);" & _
                            "Initial Catalog=物业管理系统"
        .Open
    End With
 '获取小区工作人员信息
 Set objman = New Recordset
 With objman
      Set .ActiveConnection = objcn
          .CursorLocation = adUseClient
          .CursorType = adOpenStatic
          .LockType = adLockOptimistic
          .Open "select * from 小区工作人员信息"
 End With

End Sub


Private Sub Option1_Click()
DataCombo1.BoundText = "清洁工人"
a = DataCombo1.BoundText
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find ("工种='" & a & "'")
If Adodc1.Recordset.EOF Then
   MsgBox "没有记录", vbCritical, "温馨提示"
   Exit Sub
End If
b = "select * from 小区工作人员信息 where 工种='" & Adodc1.Recordset("工种") & "'"
Adodc2.RecordSource = b
Adodc2.Refresh
DataCombo1.BoundText = ""
End Sub

Private Sub Option2_Click()

DataCombo1.BoundText = "消防工人"
a = DataCombo1.BoundText
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find ("工种='" & a & "'")
If Adodc1.Recordset.EOF Then
   MsgBox "没有记录", vbCritical, "温馨提示"
   Exit Sub
End If
b = "select * from 小区工作人员信息 where 工种='" & Adodc1.Recordset("工种") & "'"
Adodc2.RecordSource = b
Adodc2.Refresh
DataCombo1.BoundText = ""
End Sub

Private Sub Option3_Click()

DataCombo1.BoundText = "保安人员"
a = DataCombo1.BoundText
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find ("工种='" & a & "'")
If Adodc1.Recordset.EOF Then
   MsgBox "没有记录", vbCritical, "温馨提示"
   Exit Sub
End If
b = "select * from 小区工作人员信息 where 工种='" & Adodc1.Recordset("工种") & "'"
Adodc2.RecordSource = b
Adodc2.Refresh
DataCombo1.BoundText = ""
End Sub

Private Sub Option4_Click()

DataCombo1.BoundText = "维修人员"
a = DataCombo1.BoundText
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find ("工种='" & a & "'")
If Adodc1.Recordset.EOF Then
   MsgBox "没有记录", vbCritical, "温馨提示"
   Exit Sub
End If
b = "select * from 小区工作人员信息 where 工种='" & Adodc1.Recordset("工种") & "'"
Adodc2.RecordSource = b
Adodc2.Refresh
End Sub

⌨️ 快捷键说明

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