📄 canceluser.frm
字号:
VERSION 5.00
Begin VB.Form frmcanceluser
BackColor = &H0080FF80&
Caption = "删除用户"
ClientHeight = 2550
ClientLeft = 60
ClientTop = 450
ClientWidth = 4590
LinkTopic = "Form1"
ScaleHeight = 2550
ScaleWidth = 4590
StartUpPosition = 2 '屏幕中心
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 855
Left = 1560
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 3360
Visible = 0 'False
Width = 1140
End
Begin VB.CommandButton cmdcancel
Caption = "取消"
Height = 495
Left = 3000
TabIndex = 3
Top = 2880
Width = 1095
End
Begin VB.CommandButton cmdok
Caption = "删除"
Height = 495
Left = 360
TabIndex = 2
Top = 2880
Width = 1095
End
Begin VB.TextBox Text1
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2400
TabIndex = 1
Top = 1800
Width = 2175
End
Begin VB.Label Label2
BackColor = &H0000FF00&
Caption = "真的要删除用户吗?"
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1200
TabIndex = 4
Top = 480
Width = 3375
End
Begin VB.Label Label1
BackColor = &H0000FF00&
Caption = "请输入要删除的用户名"
Height = 375
Left = 240
TabIndex = 0
Top = 1920
Width = 1935
End
End
Attribute VB_Name = "frmcanceluser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdcancel_Click()
Unload frmcanceluser
End Sub
Private Sub cmdok_Click()
'查看是否具有删除用户的权限
If flag = 2 Then
MsgBox "您没有权限进行添加用户!退出操作!!"
Unload frmcanceluser
Exit Sub
End If
If Text1.Text = "" Then
MsgBox "用户名不能为空,请重新输入!!!"
Text1.SetFocus
Exit Sub
End If
Data1.Connect = "Access"
Data1.DatabaseName = "" & App.Path & "\db1.mdb"
Data1.RecordSource = "select *from user"
Data1.Refresh
'判断要删除的用户是否存在
Data1.Recordset.MoveFirst
While Data1.Recordset.Fields("User_Name") <> Text1.Text
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then
MsgBox "您要删除的用户可能已经删除了!!!"
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
Wend
'删除用户
Data1.Recordset.Delete
MsgBox "删除用户成功!!!"
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Form_Load()
If flag = 2 Then
Label1.ToolTipText = "您无权删除!"
Text1.ToolTipText = "您无权删除!"
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call cmdok_Click
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -