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

📄 frmadddept.frm

📁 数据库课程设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAddDept 
   Caption         =   "部门添加"
   ClientHeight    =   3000
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5175
   LinkTopic       =   "Form1"
   ScaleHeight     =   3000
   ScaleWidth      =   5175
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdCancel 
      Caption         =   "返回(&N)"
      Height          =   375
      Left            =   2640
      TabIndex        =   10
      Top             =   2520
      Width           =   1335
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "添加(&Y)"
      Height          =   375
      Left            =   1080
      TabIndex        =   9
      Top             =   2520
      Width           =   1335
   End
   Begin VB.Frame Frame1 
      Caption         =   "部门信息"
      Height          =   2295
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4935
      Begin VB.TextBox txtMemo 
         Height          =   735
         Left            =   1200
         TabIndex        =   8
         Text            =   "Text4"
         Top             =   1440
         Width           =   3375
      End
      Begin VB.TextBox txtOffice 
         Height          =   285
         Left            =   1200
         TabIndex        =   6
         Text            =   "Text3"
         Top             =   1080
         Width           =   3375
      End
      Begin VB.TextBox txtTel 
         Height          =   285
         Left            =   1200
         TabIndex        =   4
         Text            =   "Text2"
         Top             =   720
         Width           =   3375
      End
      Begin VB.TextBox txtName 
         Height          =   285
         Left            =   1200
         TabIndex        =   2
         Text            =   "Text1"
         Top             =   360
         Width           =   3375
      End
      Begin VB.Label Label4 
         Caption         =   "备        注:"
         Height          =   255
         Left            =   360
         TabIndex        =   7
         Top             =   1440
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "办  公  室:"
         Height          =   255
         Left            =   360
         TabIndex        =   5
         Top             =   1080
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "部门电话:"
         Height          =   255
         Left            =   360
         TabIndex        =   3
         Top             =   720
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "部门名称:"
         Height          =   255
         Left            =   360
         TabIndex        =   1
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "frmAddDept"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public sqlStr As String
Public msgText As String


Private Sub cmdCancel_Click()
Unload Me
End Sub

Private Sub cmdOK_Click()
   Dim rstDepartment As ADODB.Recordset
   Dim deptName As String
   Dim deptTel As String
   Dim deptOffice As String
   Dim memo As String
   
   '获取数据
   deptName = Trim(txtName.Text)
   deptTel = Trim(txtTel.Text)
   deptOffice = Trim(txtOffice.Text)
   memo = Trim(txtMemo.Text)
   
   If deptName = "" Then
   
      MsgBox "请将信息补充完整", vbOKOnly + vbExclamation, "警告"

      Exit Sub
   
   End If
     
   
    '添加新记录
    sqlStr = "select * from department"
    Set rstDepartment = ExecuteSQL(sqlStr, msgText)
    rstDepartment.addNew
    rstDepartment.Fields("departName") = deptName
    rstDepartment.Fields("telNo") = deptTel
    rstDepartment.Fields("roomNo") = deptOffice
    rstDepartment.Fields("memo") = memo
    
    
    rstDepartment.update
    rstDepartment.Close
    
        
    MsgBox "部门添加完成!", vbOKOnly + vbExclamation, "警告"
    
    initForm

End Sub

Private Sub Form_Load()
initForm
End Sub

Sub initForm()
txtName = ""
txtTel = ""
txtOffice = ""
txtMemo = ""
End Sub

⌨️ 快捷键说明

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