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

📄 addemployeedialog.frm

📁 VB编写的简单销售管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form AddEmployeeDialog 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "添加雇员"
   ClientHeight    =   3195
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   6030
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3195
   ScaleWidth      =   6030
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.Frame Frame1 
      Caption         =   "雇员信息"
      Height          =   2535
      Left            =   120
      TabIndex        =   2
      Top             =   120
      Width           =   5775
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   255
         Left            =   3840
         TabIndex        =   17
         Top             =   1200
         Width           =   1815
         _ExtentX        =   3201
         _ExtentY        =   450
         _Version        =   393216
         Format          =   20054017
         CurrentDate     =   38718
      End
      Begin VB.TextBox Text4 
         Height          =   855
         Left            =   960
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   15
         Top             =   1560
         Width           =   4695
      End
      Begin VB.TextBox Text3 
         Height          =   285
         Left            =   960
         TabIndex        =   13
         Top             =   1200
         Width           =   1815
      End
      Begin VB.TextBox Text2 
         Height          =   285
         Left            =   960
         TabIndex        =   11
         Top             =   840
         Width           =   1815
      End
      Begin VB.OptionButton Option2 
         Caption         =   "女"
         Height          =   255
         Left            =   4800
         TabIndex        =   9
         Top             =   840
         Width           =   495
      End
      Begin VB.OptionButton Option1 
         Caption         =   "男"
         Height          =   255
         Left            =   4200
         TabIndex        =   8
         Top             =   840
         Width           =   495
      End
      Begin VB.TextBox Text1 
         Height          =   285
         Left            =   3840
         TabIndex        =   6
         Top             =   360
         Width           =   1815
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         Caption         =   "备注"
         Height          =   195
         Left            =   360
         TabIndex        =   16
         Top             =   1920
         Width           =   360
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         Caption         =   "签约日期"
         Height          =   195
         Left            =   3000
         TabIndex        =   14
         Top             =   1200
         Width           =   720
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "职位头衔"
         Height          =   195
         Left            =   120
         TabIndex        =   12
         Top             =   1200
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "工作部门"
         Height          =   195
         Left            =   120
         TabIndex        =   10
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "雇员性别"
         Height          =   195
         Left            =   3000
         TabIndex        =   7
         Top             =   840
         Width           =   720
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "雇员姓名"
         Height          =   195
         Left            =   3000
         TabIndex        =   5
         Top             =   360
         Width           =   720
      End
      Begin VB.Label Label2 
         BorderStyle     =   1  'Fixed Single
         Height          =   255
         Left            =   960
         TabIndex        =   4
         Top             =   360
         Width           =   1815
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "雇员编号"
         Height          =   195
         Left            =   120
         TabIndex        =   3
         Top             =   360
         Width           =   720
      End
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "Cancel"
      Height          =   375
      Left            =   3480
      TabIndex        =   1
      Top             =   2760
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "OK"
      Height          =   375
      Left            =   1440
      TabIndex        =   0
      Top             =   2760
      Width           =   1215
   End
End
Attribute VB_Name = "AddEmployeeDialog"
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 Form_Load()
    Set MyDB = OpenDatabase(VB.App.Path + "\MySampleDB.mdb", False, False)
    Set MyRecord = MyDB.OpenRecordset("雇员表")
    MyRecord.Index = "PrimaryKey"
    MyRecord.MoveLast
    TempStr = MyRecord.Fields("EmployeeID")
    TempStr = "SC" & Format((Val(Right(TempStr, 4)) + 1), "000#")
    Label2.Caption = TempStr
    Option1.Value = True
End Sub

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

Private Sub OKButton_Click()
    If Text1.Text = "" Then
        MsgBox "请输入 雇员姓名 !"
        Exit Sub
    End If
    If Text2.Text = "" Then
        MsgBox "请输入 工作部门 !"
        Exit Sub
    End If
    If Text3.Text = "" Then
        MsgBox "请输入 职位头衔 !"
        Exit Sub
    End If
    TempStr = "INSERT INTO 雇员表 VALUES ('" & Label2.Caption & "','" & Text1.Text & _
                    "'," & Option1.Value & ",'" & Text2.Text & "','" & Text3.Text & _
                    "','" & DTPicker1.Value & "','" & Text4.Text & "')"
    MyDB.Execute TempStr
    MsgBox "成功添加雇员" & Label2.Caption & "!"
    Unload Me
End Sub

⌨️ 快捷键说明

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