📄 frmscczy.frm
字号:
VERSION 5.00
Begin VB.Form frmscczy
Caption = "兴盛牙刷销存管理系统--删除操作员"
ClientHeight = 3195
ClientLeft = 3690
ClientTop = 2970
ClientWidth = 4680
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 3195
ScaleWidth = 4680
Begin VB.CommandButton Command2
Caption = "返 回"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2760
TabIndex = 2
Top = 2160
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确 认"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 720
TabIndex = 1
Top = 2160
Width = 1095
End
Begin VB.TextBox txtuser
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2160
TabIndex = 0
Top = 720
Width = 1695
End
Begin VB.Label Label1
Caption = "用 户 名:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 3
Top = 840
Width = 1335
End
End
Attribute VB_Name = "frmscczy"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
DefaultType = dbUseODBC
Dim db As Database
Dim rs As Recordset
Dim cx As Boolean
cx = False
Set db = OpenDatabase("xsys", dbDriverNoPrompt, False, "odbc;database=glxt;uid=;pwd=;dsn=xsys")
Set rs = db.OpenRecordset("yhk", dbOpenDynaset, dbwrite, dbOptimistic)
Do While rs.EOF <> True
If rs.Fields("用户名") = LTrim(txtuser.Text) Then
cx = True
Exit Do
End If
If rs.EOF = True Then
Exit Do
End If
rs.MoveNext
Loop
If txtuser.Text = "" Then
MsgBox "填写不能为空,请重新填写!", vbCritical, "错误"
Else
If MsgBox("请确认填写无误,否则修改!", vbOKCancel, "提示") = vbOK Then
If cx = False Then
MsgBox "此用户不存在,请重新输入用户!"
txtuser.SetFocus
Else
If txtuser.Text = "系统管理员" Then
MsgBox "您不能删除系统管理员,否则将无法登录!请重新输入"
txtuser.Text = ""
txtuser.SetFocus
Else
With rs
.Delete
.Close
End With
MsgBox "用户已经删除!", vbInformation, "提示"
txtuser.Text = ""
End If
End If
Else
Command2.SetFocus
End If
End If
db.Close
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Dim nexttabindex As Integer, i As Integer
If KeyAscii = 13 Then
If Screen.ActiveControl.TabIndex = Count - 1 Then
nexttabindex = 0
Else
nexttabindex = Screen.ActiveControl.TabIndex + 1
End If
For i = 0 To Count - 1
If Me.Controls(i).TabIndex = nexttabindex Then
Me.Controls(i).SetFocus
Exit For
End If
Next i
KeyAscii = 0
End If
End Sub
Private Sub txtuser_lostfocus()
DefaultType = dbUseODBC
Dim db As Database
Dim rs As Recordset
Dim cx As Boolean
cx = False
Set db = OpenDatabase("xsys", dbDriverNoPrompt, False, "odbc;database=glxt;uid=;pwd=;dsn=xsys")
Set rs = db.OpenRecordset("yhk", dbOpenDynaset, dbwrite, dbOptimistic)
Do While rs.EOF <> True
If rs.Fields("用户名") = LTrim(txtuser.Text) Then
cx = True
Exit Do
End If
If rs.EOF = True Then
Exit Do
End If
rs.MoveNext
Loop
If cx = True Then
txtuser.Text = rs.Fields("用户名")
Else
MsgBox "此用户不存在,请重新输入!"
txtuser.Text = ""
Command2.SetFocus
End If
rs.Close
db.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -