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

📄 setuser1.frm

📁 系统实现了图书的添加
💻 FRM
字号:
VERSION 5.00
Begin VB.Form setuser1 
   Caption         =   "编辑系统用户"
   ClientHeight    =   5520
   ClientLeft      =   60
   ClientTop       =   420
   ClientWidth     =   6015
   LinkTopic       =   "Form1"
   ScaleHeight     =   5520
   ScaleWidth      =   6015
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Height          =   375
      Index           =   1
      Left            =   1680
      TabIndex        =   7
      Top             =   1200
      Width           =   1695
   End
   Begin VB.CommandButton Comm2 
      Caption         =   "取    消"
      Height          =   375
      Left            =   2640
      TabIndex        =   5
      Top             =   3000
      Width           =   855
   End
   Begin VB.CommandButton Comm1 
      Caption         =   "确    定"
      Height          =   375
      Left            =   720
      TabIndex        =   4
      Top             =   3000
      Width           =   855
   End
   Begin VB.Frame Frame1 
      Caption         =   "用户编辑"
      Height          =   2535
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   3735
      Begin VB.ComboBox Combo1 
         Height          =   300
         ItemData        =   "setuser1.frx":0000
         Left            =   1320
         List            =   "setuser1.frx":000A
         TabIndex        =   8
         Top             =   1440
         Width           =   1695
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Index           =   0
         Left            =   1320
         TabIndex        =   6
         Top             =   480
         Width           =   1695
      End
      Begin VB.Label Label3 
         Caption         =   "用户级别"
         Height          =   255
         Left            =   360
         TabIndex        =   3
         Top             =   1560
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "口    令"
         Height          =   255
         Left            =   360
         TabIndex        =   2
         Top             =   1080
         Width           =   1095
      End
      Begin VB.Label Label1 
         Caption         =   "用 户 名"
         Height          =   255
         Left            =   360
         TabIndex        =   1
         Top             =   600
         Width           =   975
      End
   End
End
Attribute VB_Name = "setuser1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cond As String


Private Sub Comm1_Click()
   If Trim(Text1(0).Text) = "" Or Trim(Text1(1).Text) = "" _
      Or Trim(Combo1.Text) = "" Then
      MsgBox "数据项不全,请重新设置", vbOKOnly, "信息提示"
      Text1(0).SetFocus
      Exit Sub
   End If
   If flag = 1 Then
      If setuser.Adodc1.Recordset.RecordCount > 0 Then
         cond = "级别='" + Trim(Text1(0).Text) + "'"
         setuser.Adodc1.Recordset.MoveFirst
         setuser.Adodc1.Recordset.Find (cond)
         If Not setuser.Adodc1.Recordset.EOF() Then
            MsgBox "存在完全相同的记录", vbOKOnly, "信息提示"
            Text1(0).SetFocus
            Exit Sub
        End If
      End If
      setuser.Adodc1.Recordset.AddNew
      setuser.Adodc1.Recordset.Fields("用户名") = Trim(Text1(0).Text)
      setuser.Adodc1.Recordset.Fields("口令") = Val(Text1(1).Text)
      setuser.Adodc1.Recordset.Fields("用户级别") = Trim(Text1(2).Text)
      setuser.Adodc1.Recordset.Update
      recs = recs + 1
    Else
      n = setuser.Adodc1.Recordset.AbsolutePosition
      cond = "级别='" + Trim(Text1(0).Text) + "'"
      setuser.Adodc1.Recordset.MoveFirst
      setuser.Adodc1.Recordset.Find (cond)
      If Not setuser.Adodc1.Recordset.EOF() And _
             setuser.Adodc1.Recordset.AbsolutePosition <> n Then
         MsgBox "存在完全相同的记录", vbOKOnly, "信息提示"
         setuser.Adodc1.Recordset.MoveFirst
         setuser.Adodc1.Recordset.Move (n - 1)
         Text1(0).SetFocus
         Exit Sub
      End If
      setuser.Adodc1.Recordset.MoveFirst
      setuser.Adodc1.Recordset.Move (n - 1)
      setuser.Adodc1.Recordset.Fields("用户名") = Trim(Text1(0).Text)
      setuser.Adodc1.Recordset.Fields("口令") = Val(Text1(1).Text)
      setuser.Adodc1.Recordset.Fields("级别") = Trim(Combo1.Text)
      setuser.Adodc1.Recordset.Update
   End If
   Unload Me
End Sub

Private Sub Comm2_Click()
  Unload Me
End Sub


Private Sub Form_KeyPress(KeyAscii As Integer)
   If KeyAscii = 13 Then
      SendKeys "{TAB}"
   End If
End Sub

Private Sub Form_Load()
   If flag = 2 Then
      Text1(0).Text = setuser.Adodc1.Recordset.Fields("用户名")
      Text1(1).Text = setuser.Adodc1.Recordset.Fields("口令")
      Combo1.Text = setuser.Adodc1.Recordset.Fields("级别")
   End If
End Sub

Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
  Call endata(KeyAscii)
End Sub


⌨️ 快捷键说明

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