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

📄 frmusers.frm

📁 simple supermarket for beginners
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmusers 
   BackColor       =   &H80000013&
   Caption         =   "Admin Deletion"
   ClientHeight    =   2910
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   6060
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   2910
   ScaleWidth      =   6060
   WindowState     =   2  'Maximized
   Begin OnTheSpot.isButton cmddelete 
      Height          =   615
      Left            =   3840
      TabIndex        =   6
      Top             =   1920
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   1085
      Icon            =   "frmusers.frx":0000
      Style           =   9
      Caption         =   "&Delete"
      iNonThemeStyle  =   0
      Tooltiptitle    =   ""
      ToolTipIcon     =   0
      ToolTipType     =   1
      ttForeColor     =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      MaskColor       =   0
      RoundedBordersByTheme=   0   'False
   End
   Begin VB.TextBox txtemp_no 
      Height          =   285
      Left            =   3840
      Locked          =   -1  'True
      TabIndex        =   4
      Top             =   960
      Width           =   2055
   End
   Begin VB.CommandButton cmddeleted 
      BackColor       =   &H00E0E0E0&
      Caption         =   "Delete!"
      Enabled         =   0   'False
      Height          =   495
      Left            =   3840
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   1920
      Width           =   2055
   End
   Begin VB.TextBox txtusername 
      Height          =   285
      Left            =   3840
      Locked          =   -1  'True
      TabIndex        =   1
      Top             =   1320
      Width           =   2055
   End
   Begin VB.ListBox lstadmin 
      Height          =   2400
      Left            =   240
      TabIndex        =   0
      Top             =   360
      Width           =   1935
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   " Employee Number"
      Height          =   255
      Left            =   2280
      TabIndex        =   5
      Top             =   960
      Width           =   1455
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   " User Name"
      Height          =   255
      Left            =   2280
      TabIndex        =   2
      Top             =   1320
      Width           =   1095
   End
End
Attribute VB_Name = "frmusers"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cn As ADODB.Connection
Dim RS As ADODB.Recordset, rs1 As ADODB.Recordset, rs2 As ADODB.Recordset

Private Sub cmddelete_Click()
'Ensure that if only one record is in the database, it is not
'deleted as a database should not have less than one record as this causes
'errors at the front end.
If RS.RecordCount = 1 Then
    MsgBox "Only one record in database, Do not Delete!"
    Exit Sub
End If

'do the actual deleting
rs1.Delete

'move the cursor from the deleted record.
If Not RS.EOF Then
    RS.MoveNext
Else
    RS.MovePrevious
End If

'clear the list and populate it again to keep up with the changes.
lstadmin.clear
popul8_list

End Sub

Private Sub Form_Load()

On Error Resume Next

Set cn = New ADODB.Connection
Set RS = New ADODB.Recordset
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=TRANSPORT.MDB;Persist Security Info=False"
RS.Open "select * from Admin", cn, adOpenDynamic, adLockPessimistic
RS.MoveFirst
popul8_list
Display
If Err Then
MsgBox Err.Number + Err.Description
End If

End Sub

Public Sub popul8_list()
    RS.Close
RS.Open "select * from Admin", cn, adOpenDynamic, adLockPessimistic
Do
    lstadmin.AddItem RS("Uname")
    RS.MoveNext
Loop Until RS.EOF = True
RS.MoveFirst
End Sub

Private Sub lstadmin_Click()
Set rs1 = New ADODB.Recordset
rs1.Open "select * from Admin where uname='" & lstadmin.List(lstadmin.ListIndex) & "'", cn, adOpenDynamic, adLockPessimistic
cmddelete.Enabled = True
txtusername = (lstadmin.List(lstadmin.ListIndex))
txtemp_no = rs1("Emp_ID")
End Sub

Public Sub Display()
txtusername = RS("uname")
txtemp_no = RS("Emp_ID")
End Sub

⌨️ 快捷键说明

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