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

📄 del_user.frm

📁 实现画图
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Del_User 
   Caption         =   "删除用户"
   ClientHeight    =   2130
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5100
   LinkTopic       =   "Form4"
   ScaleHeight     =   2130
   ScaleWidth      =   5100
   StartUpPosition =   3  '窗口缺省
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access 2000;"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   735
      Left            =   960
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   2880
      Visible         =   0   'False
      Width           =   2175
   End
   Begin VB.CommandButton Command2 
      Caption         =   "取消"
      Height          =   615
      Left            =   2280
      TabIndex        =   3
      Top             =   1320
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确认"
      Height          =   615
      Left            =   600
      TabIndex        =   2
      Top             =   1320
      Width           =   1335
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   2520
      TabIndex        =   1
      Top             =   360
      Width           =   1815
   End
   Begin VB.Label Label1 
      Caption         =   "请输入要删除的用户名"
      Height          =   495
      Left            =   120
      TabIndex        =   0
      Top             =   480
      Width           =   2055
   End
End
Attribute VB_Name = "Del_User"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
     
 If UserName = Trim(Data1.Recordset.Fields(0)) Then
    If Trim(Data1.Recordset.Fields(2)) = 0 Then
           Me.Hide
         MsgBox "您不是管理员,无权进行此操作!", vbOKOnly + vbExclamation, "警告"
      
     Else
       
      If Text1.Text = "" Then
        MsgBox "请输入要删除的用户名!", vbOKOnly + vbExclamation, "警告 "
        Text1.SetFocus
       Else
         While (Data1.Recordset.EOF = False)
          If Data1.Recordset.Fields("UserName").Value = Text1.Text Then
             MsgBox "确定要删除该用户吗?", vbOKCancel, "警告 "
             If vbOK Then
                Data1.Recordset.Delete
                Me.Hide
                  MsgBox "删除用户成功!", vbOKOnly + vbExclamation, "删除用户 "
                  Exit Sub
             Else
                  Text1.SetFocus
                 Text1.Text = ""
                 Exit Sub
               
                End If
            Else
                MsgBox "要删除的用户不存在,请确认!", vbOKOnly + vbExclamation, "警告 "
                 Text1.SetFocus
                 Text1.Text = ""
           End If
        Wend
        End If
    End If
End If
           
               
             
End Sub

Private Sub Command2_Click()
Me.Text1.SetFocus
Me.Text1.Text = ""
End Sub

Private Sub Form_Load()
Me.Data1.DatabaseName = App.Path + "\11.mdb"
Me.Data1.RecordSource = "UserTable"
End Sub

⌨️ 快捷键说明

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