📄 frmdelete.frm
字号:
VERSION 5.00
Begin VB.Form frmDelete
Caption = "会员退会 "
ClientHeight = 3525
ClientLeft = 60
ClientTop = 450
ClientWidth = 4785
LinkTopic = "Form1"
ScaleHeight = 3525
ScaleWidth = 4785
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton cmdBack
Caption = "返 回"
Height = 495
Left = 3000
TabIndex = 4
Top = 2280
Width = 1215
End
Begin VB.CommandButton cmdDel
Caption = " 清 空 "
Height = 495
Left = 1560
TabIndex = 3
Top = 2280
Width = 1215
End
Begin VB.CommandButton cmdSub
Caption = "提 交"
Height = 495
Left = 240
TabIndex = 2
Top = 2280
Width = 1095
End
Begin VB.TextBox txtId
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 480
Left = 600
TabIndex = 1
Top = 1320
Width = 2655
End
Begin VB.Label Label1
Caption = "请输入要退会的会员的ID:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 0
Top = 480
Width = 2895
End
End
Attribute VB_Name = "frmDelete"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdBack_Click()
Unload Me
frmAdmin.Show
End Sub
Private Sub cmdDel_Click()
txtId.Text = ""
txtId.SetFocus
End Sub
Private Sub cmdSub_Click()
If txtId.Text Like "" Then
MsgBox "对不起,ID不能为空!", vbOKOnly + vbExclamation, "错误"
txtId.SetFocus
Exit Sub
End If
Dim response
Set db = OpenDatabase("Haiyu.mdb")
Set rs = db.OpenRecordset("SELECT * FROM Customer")
rs.MoveFirst
Do Until rs.EOF
If rs!ID = txtId.Text Then
response = MsgBox("是否确定删除ID为" & txtId.Text & "的用户?", vbOKCancel + vbQuestion, "确定信息")
If response = 1 Then
With rs
.Delete
End With
MsgBox "ID为" & txtId.Text & "的用户已成功删除!", vbOKOnly + vbExclamation, "删除成功"
Unload Me
frmAdmin.Show
Exit Sub
Else
Unload Me
frmAdmin.Show
Exit Sub
End If
Else
rs.MoveNext
End If
Loop
MsgBox "对不起,您输入的ID不存在,请重新输入!", vbOKOnly + vbExclamation, "错误"
txtId.Text = ""
txtId.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -