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

📄 添加删除会员.frm

📁 一个很有意思的点菜系统前后台连接齐全~做课程设计的同学可以参考
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmaddmember 
   BackColor       =   &H00C0E0FF&
   Caption         =   "添加/删除 会员"
   ClientHeight    =   5115
   ClientLeft      =   4395
   ClientTop       =   3945
   ClientWidth     =   6450
   LinkTopic       =   "Form4"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5115
   ScaleWidth      =   6450
   Begin VB.CommandButton Command1 
      Caption         =   "添加"
      Height          =   375
      Left            =   1200
      TabIndex        =   6
      Top             =   4080
      Width           =   855
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   2880
      TabIndex        =   5
      Top             =   1320
      Width           =   1455
   End
   Begin VB.TextBox Text2 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2880
      PasswordChar    =   "*"
      TabIndex        =   4
      Top             =   2160
      Width           =   1455
   End
   Begin VB.TextBox Text3 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   2880
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   3000
      Width           =   1455
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   375
      Left            =   4080
      TabIndex        =   2
      Top             =   4080
      Width           =   855
   End
   Begin VB.CommandButton Command3 
      Caption         =   "删除"
      Height          =   375
      Left            =   2640
      TabIndex        =   1
      Top             =   4080
      Width           =   855
   End
   Begin VB.Label Label2 
      BackColor       =   &H00C0E0FF&
      Caption         =   "口令"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1680
      TabIndex        =   8
      Top             =   2160
      Width           =   495
   End
   Begin VB.Label Label3 
      BackColor       =   &H00C0E0FF&
      Caption         =   "确认"
      Height          =   255
      Left            =   1680
      TabIndex        =   7
      Top             =   3000
      Width           =   495
   End
   Begin VB.Label Label1 
      BackColor       =   &H00C0E0FF&
      Caption         =   "会员名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   1560
      TabIndex        =   0
      Top             =   1440
      Width           =   735
   End
End
Attribute VB_Name = "frmaddmember"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Private Sub Command1_Click()
dcpath = "c:\点菜系统.mdb"
Set dcdb = OpenDatabase(dcpath)
Set hytable = dcdb.OpenRecordset("会员表", dbOpenTable)
i = i + 1
If Text1.Text = "" Then
   MsgBox "会员名不能为空!"
   Text1.SetFocus
   Exit Sub
End If
If Text2.Text = "" Then
   MsgBox "会员口令不能为空!"
   Text2.SetFocus
   Exit Sub
End If
If Text2.Text <> Text3.Text Then
  MsgBox "两次输入的口令不一致!"
  Text3.Text = ""
  Text3.SetFocus
  Exit Sub
End If
hytable.MoveFirst
While Not hytable.EOF
  If hytable.Fields(0) = Text1.Text Then
    MsgBox "此会员已存在!"
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text1.SetFocus
    Exit Sub
  End If
  hytable.MoveNext
Wend
hytable.MoveLast
hytable.AddNew
hytable.Fields(0) = Text1.Text
hytable.Fields(1) = Text2.Text
hytable.Fields(3) = 100
hytable.Fields(5) = 95
hytable.Update
MsgBox "新会员已成功添加!"
If username = "新顾客" And i = 1 Then
  Form1.addmember.Enabled = False
  Unload Me
End If
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
hytable.MoveFirst
While Not hytable.EOF
  If hytable.Fields(0) = Text1.Text Then
    hytable.Delete
    MsgBox "此会员被成功删除!"
    Exit Sub
  End If
  hytable.MoveNext
Wend
MsgBox "无此会员!"
Text1.Text = ""
Text1.SetFocus
End Sub

Private Sub Form_Load()
Form1.Enabled = False
dcpath = "c:\点菜系统.mdb"
Set dcdb = OpenDatabase(dcpath)
Set hytable = dcdb.OpenRecordset("会员表", dbOpenTable)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Form1.Enabled = True
dcpath = "c:\点菜系统.mdb"
Set dcdb = OpenDatabase(dcpath)
dcdb.Close
End Sub

⌨️ 快捷键说明

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