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

📄 browseemployeedialog.frm

📁 商品销售管理系统,用Accsee作为数据库,VB编程,可直接运行,用以作为课程设计足以!
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form BrowseEmployeeDialog 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "雇员浏览"
   ClientHeight    =   3660
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   6030
   ClipControls    =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3660
   ScaleWidth      =   6030
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command2 
      Caption         =   "删除"
      Height          =   375
      Left            =   2400
      TabIndex        =   21
      Top             =   3000
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "修改"
      Height          =   375
      Left            =   1320
      TabIndex        =   20
      Top             =   3000
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Caption         =   "个人信息"
      Height          =   2295
      Left            =   1320
      TabIndex        =   4
      Top             =   0
      Width           =   4695
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   300
         Left            =   3120
         TabIndex        =   19
         Top             =   960
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   529
         _Version        =   393216
         Enabled         =   0   'False
         Format          =   25559041
         CurrentDate     =   39083
      End
      Begin VB.TextBox Text6 
         Enabled         =   0   'False
         Height          =   855
         Left            =   720
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   18
         Top             =   1320
         Width           =   3855
      End
      Begin VB.OptionButton Option2 
         Caption         =   "女"
         Enabled         =   0   'False
         Height          =   255
         Left            =   1440
         TabIndex        =   16
         Top             =   600
         Width           =   495
      End
      Begin VB.OptionButton Option1 
         Caption         =   "男"
         Enabled         =   0   'False
         Height          =   255
         Left            =   720
         TabIndex        =   15
         Top             =   600
         Width           =   495
      End
      Begin VB.TextBox Text4 
         Enabled         =   0   'False
         Height          =   285
         Left            =   720
         TabIndex        =   14
         Top             =   960
         Width           =   1215
      End
      Begin VB.TextBox Text3 
         Enabled         =   0   'False
         Height          =   285
         Left            =   2760
         TabIndex        =   13
         Top             =   600
         Width           =   1815
      End
      Begin VB.TextBox Text2 
         Enabled         =   0   'False
         Height          =   285
         Left            =   2760
         TabIndex        =   12
         Top             =   240
         Width           =   1815
      End
      Begin VB.TextBox Text1 
         Enabled         =   0   'False
         Height          =   285
         Left            =   720
         TabIndex        =   11
         Top             =   240
         Width           =   1215
      End
      Begin VB.Label Label13 
         AutoSize        =   -1  'True
         Caption         =   "备注"
         Height          =   195
         Left            =   120
         TabIndex        =   17
         Top             =   1680
         Width           =   360
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "启用日期"
         Height          =   195
         Left            =   2160
         TabIndex        =   10
         Top             =   960
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "职位"
         Height          =   195
         Left            =   120
         TabIndex        =   9
         Top             =   960
         Width           =   360
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "部门"
         Height          =   195
         Left            =   2160
         TabIndex        =   8
         Top             =   600
         Width           =   360
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "性别"
         Height          =   195
         Left            =   120
         TabIndex        =   7
         Top             =   600
         Width           =   360
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "编号"
         Height          =   195
         Left            =   2160
         TabIndex        =   6
         Top             =   240
         Width           =   360
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "姓名"
         Height          =   195
         Left            =   120
         TabIndex        =   5
         Top             =   240
         Width           =   360
      End
   End
   Begin VB.Frame EmployeeName 
      Caption         =   "雇员编号"
      Height          =   3375
      Left            =   0
      TabIndex        =   2
      Top             =   120
      Width           =   1215
      Begin VB.ListBox List1 
         Height          =   2940
         Left            =   120
         TabIndex        =   3
         Top             =   240
         Width           =   975
      End
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消"
      Height          =   375
      Left            =   5040
      TabIndex        =   1
      Top             =   3000
      Width           =   975
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "确认"
      Height          =   375
      Left            =   3960
      TabIndex        =   0
      Top             =   3000
      Width           =   975
   End
End
Attribute VB_Name = "BrowseEmployeeDialog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim MyDB As Database
Dim MyRecord As Recordset
Dim TempStr As String

Private Sub CancelButton_Click()
    Unload Me
End Sub

Private Sub Command1_Click()
    If frmLogin.IsAdmin = False Then
        MsgBox "一般用户不具备修改权限!"
        Exit Sub
    End If
    If List1.SelCount = 0 Then
        MsgBox "请选定一名雇员 !"
        Exit Sub
    End If
    Text1.Enabled = True
    Option1.Enabled = True
    Option2.Enabled = True
    Text3.Enabled = True
    Text4.Enabled = True
    DTPicker1.Enabled = True
    Text6.Enabled = True
    Command1.Enabled = False
    Command2.Enabled = False
End Sub

Private Sub Command2_Click()
Dim sure As Integer
sure = MsgBox("确定删除?", vbYesNo)
If sure = vbYes Then
    TempStr = "DELETE FROM 雇员表 WHERE EmployeeID='" & Text2.Text & "'"
    MyDB.Execute TempStr
    MsgBox "成功删除雇员 " & Text2.Text & " !"
    Text1.Text = ""
    Text2.Text = ""
    Option1.Value = False
    Option2.Value = False
    Text3.Text = ""
    Text4.Text = ""
    DTPicker1.Value = "2006-1-1"
    Text6.Text = ""
    List1.RemoveItem List1.ListIndex
   
 Else
    Exit Sub
 End If
End Sub

Private Sub Data1_Reposition()
    If Not (Data1.Recordset.EOF And Data1.Recordset.BOF) Then
        Data2.DatabaseName = VB.App.Path + "\MySampleDB.mdb"
        Data2.RecordSource = "select * from 客户表 where CustomerID='" & Data1.Recordset("CustomerID") & "'"
        Data2.Refresh
        Data3.DatabaseName = VB.App.Path + "\MySampleDB.mdb"
        Data3.RecordSource = "select * from 产品表 where ProductID='" & Data1.Recordset("ProductID") & "'"
        Data3.Refresh
    
    End If
End Sub

Private Sub Form_Load()
   
    Set MyDB = OpenDatabase(VB.App.Path + "\MySampleDB.mdb", False, False)
    Set MyRecord = MyDB.OpenRecordset("雇员表")
    MyRecord.Index = "PrimaryKey"
    Do While Not MyRecord.EOF
        List1.AddItem MyRecord.Fields("EmployeeID")
        MyRecord.MoveNext
    Loop
End Sub

Private Sub Form_Unload(Cancel As Integer)
    MyRecord.Close
    MyDB.Close
End Sub

Private Sub List1_Click()
    Command1.Enabled = True
    MyRecord.Index = "PrimaryKey"
    MyRecord.Seek "=", List1.Text
    If MyRecord.NoMatch Then
        MsgBox "没有编号为" + List1.Text + "的人!"
    Else
        Text1.Text = MyRecord.Fields("Name")
        Text2.Text = List1.Text
        If MyRecord.Fields("Sex") = True Then Option1.Value = True Else Option2.Value = True
        Text3.Text = MyRecord.Fields("Department")
        Text4.Text = MyRecord.Fields("Title")
        DTPicker1.Value = MyRecord.Fields("HireDate")
        If Not IsNull(MyRecord.Fields("Memo")) Then
            Text6.Text = MyRecord.Fields("Memo")
        Else
            Text6.Text = ""
        End If
        
    End If
End Sub

Private Sub OKButton_Click()
    If Command1.Enabled = True Then
        Unload Me
    Else
        If Text1.Text = "" Then
            MsgBox "请输入 姓名 !"
            Exit Sub
        End If
        If Text3.Text = "" Then
            MsgBox "请输入 部门 !"
            Exit Sub
        End If
        If Option1.Value = False And Option2.Value = False Then
            MsgBox "请输入 性别 !"
            Exit Sub
        End If
        If Text4.Text = "" Then
            MsgBox "请输入 职位 !"
            Exit Sub
        End If
                
        TempStr = "UPDATE 雇员表 SET Name='" & Text1.Text & "',Sex=" & Option1.Value & _
                        ",Department='" & Text3.Text & "',Title='" & Text4.Text & "',HireDate='" _
                        & DTPicker1.Value & "',Memo='" & Text6.Text & "' WHERE EmployeeID='" & Text2.Text & "'"
        MyDB.Execute TempStr
        MsgBox "成功修改雇员" & Text2.Text & "!"
        Text1.Enabled = False
        Option1.Enabled = False
        Option2.Enabled = False
        Text3.Enabled = False
        Text4.Enabled = False
        DTPicker1.Enabled = False
        Text6.Enabled = False
        Command1.Enabled = True
        Command2.Enabled = True
    End If
End Sub

⌨️ 快捷键说明

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