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

📄 frm_systemer.frm

📁 vb+aceess制作的库存管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm_systemer 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "用户管理"
   ClientHeight    =   2205
   ClientLeft      =   3645
   ClientTop       =   2925
   ClientWidth     =   4920
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2205
   ScaleWidth      =   4920
   ShowInTaskbar   =   0   'False
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   720
      Top             =   3480
      Width           =   2415
      _ExtentX        =   4260
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   1
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.TextBox Text5 
      Height          =   375
      Left            =   840
      TabIndex        =   14
      Text            =   "1"
      Top             =   2880
      Width           =   1455
   End
   Begin VB.Frame Frame3 
      Caption         =   "操作选择"
      Height          =   700
      Left            =   60
      TabIndex        =   9
      Top             =   60
      Width           =   4815
      Begin VB.OptionButton Option1 
         Caption         =   "注册新用户"
         Height          =   375
         Left            =   840
         TabIndex        =   11
         Top             =   240
         Width           =   1455
      End
      Begin VB.OptionButton Option2 
         Caption         =   "删除现有的用户"
         Height          =   375
         Left            =   2640
         TabIndex        =   10
         Top             =   240
         Width           =   1815
      End
   End
   Begin VB.CommandButton Command3 
      Caption         =   "取消"
      Height          =   350
      Left            =   3900
      TabIndex        =   8
      Top             =   1850
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   350
      Left            =   2900
      TabIndex        =   6
      Top             =   1850
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "确定"
      Height          =   350
      Left            =   2900
      TabIndex        =   7
      Top             =   1850
      Width           =   975
   End
   Begin VB.Frame Frame2 
      Height          =   1000
      Left            =   60
      TabIndex        =   1
      Top             =   800
      Width           =   4815
      Begin VB.TextBox Text4 
         Height          =   300
         IMEMode         =   3  'DISABLE
         Left            =   3240
         PasswordChar    =   "*"
         TabIndex        =   18
         Top             =   600
         Width           =   1455
      End
      Begin VB.TextBox Text3 
         Height          =   300
         IMEMode         =   3  'DISABLE
         Left            =   960
         PasswordChar    =   "*"
         TabIndex        =   17
         Top             =   600
         Width           =   1335
      End
      Begin VB.TextBox Text2 
         Height          =   300
         Left            =   3240
         TabIndex        =   16
         Top             =   240
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         Height          =   300
         Left            =   960
         TabIndex        =   15
         Top             =   240
         Width           =   1335
      End
      Begin VB.Label Label5 
         Caption         =   "职务"
         Height          =   255
         Left            =   2400
         TabIndex        =   13
         Top             =   320
         Width           =   615
      End
      Begin VB.Label Label3 
         Caption         =   "确认密码"
         Height          =   225
         Left            =   2400
         TabIndex        =   4
         Top             =   720
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "用户密码"
         Height          =   200
         Left            =   120
         TabIndex        =   3
         Top             =   720
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "用户名称"
         Height          =   255
         Left            =   120
         TabIndex        =   2
         Top             =   320
         Width           =   855
      End
   End
   Begin VB.Frame Frame1 
      Height          =   1000
      Left            =   60
      TabIndex        =   0
      Top             =   800
      Width           =   4815
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   1320
         Style           =   2  'Dropdown List
         TabIndex        =   12
         Top             =   530
         Width           =   2325
      End
      Begin VB.Label Label4 
         Caption         =   "请选择您要删除的用户名称"
         Height          =   255
         Left            =   1360
         TabIndex        =   5
         Top             =   240
         Width           =   2175
      End
   End
End
Attribute VB_Name = "frm_systemer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim a
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
  If KeyCode = 13 Then
      Call Command2_Click
  Else
  End If
End Sub

'*** 用户注册信息的事件代码 ***
Private Sub Command1_Click()
  rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3)     '运用API函数SetWindowPos,来实现取消窗体置前的功能
  If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
  MsgBox "输入的用户注册信息不完全!!", , "提示信息"
  Else
       Adodc1.RecordSource = "select * from tb_enter where M_Name='" + Text1 + "'"  '判断注册的用户名是否存在
       Adodc1.Refresh
          If Adodc1.Recordset.RecordCount > 0 Then
                  MsgBox "该用户名已经存在,请您更换其他用户名!", 48, "提示信息"
                  Text1.Text = ""                                                   '如果该用户名存在则重新输入
                  Text2.Text = ""
                  Text3.Text = ""
                  Text4.Text = ""
                  Text1.SetFocus
          Else

                If Text3.Text = Text4.Text Then                                    '判断两次输入的密码是否一致
                    Adodc1.RecordSource = "select * from tb_enter order by M_ID"
                    Adodc1.Refresh
                                If Adodc1.Recordset.RecordCount > 0 Then
                                       Adodc1.Recordset.MoveLast
                                       Text5.Text = Val(Adodc1.Recordset.Fields("M_ID")) + 1
                                 Else
                                       Text5.Text = 1
                                 End If
                                      Call main
                                                '保存注册信息
                                         Set adoRs = adoCon.Execute("insert into tb_enter values(" & Text5 & ",'" & Text1 & "','" & Text2 & "','" & Text3 & "','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0')")
                                         MsgBox "注册成功!!", 48, "用户注册信息提示"
                                      adoCon.Close
                                           Text1.Text = ""
                                           Text2.Text = ""
                                           Text3.Text = ""
                                           Text4.Text = ""
                                           Unload Me
                  Else
                         MsgBox "两次输入的密码不一致,请您确认后重新输入", 48, "用户注册信息提示"
                         Text3.Text = ""
                         Text4.Text = ""
                          Text3.SetFocus
                 End If
          End If
    End If
End Sub
'*** 删除用户信息的事件代码 ***
Private Sub Command2_Click()
  rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3)        '运用API函数SetWindowPos,来实现取消窗体置前的功能
     If Combo1.Text = Name1 Then                        '如果是当前登录的用户名,则不允许删除
         MsgBox "不能删除当前用户名!!", 48, "提示信息"
     Else
         a = MsgBox("您确认要删除该用户吗?", 17, "删除用户信息提示")
            If a = vbOK Then
                 Adodc1.RecordSource = "select * from tb_enter where M_Name='" + Combo1.Text + "'"
                 Adodc1.Refresh
                      If Adodc1.Recordset.RecordCount > 0 Then
                             Adodc1.Recordset.Delete                      '如果数据库中存在该用户信息,则将其删除
                             MsgBox "用户信息删除成功", 64, "删除用户信息提示"
                             Unload Me
                      Else
                             MsgBox "当前数据库中没有可删除的用户信息", , "信息提示"
                      End If
              End If
      End If
End Sub

Private Sub Command3_Click()
  Unload Me
End Sub
Private Sub Form_Activate()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
If Option1.Value = 1 Then
Frame2.Visible = True
Frame1.Visible = False
Command1.Visible = True
Command2.Visible = False
ElseIf Option2.Value = 1 Then
Frame1.Visible = True
Frame2.Visible = False
Command2.Visible = True
Command1.Visible = False
Else
End If
End Sub
Private Sub Form_Load()
    rtn = SetWindowPos(Me.hwnd, -1, 0, 0, 0, 0, 3)     '运用API函数SetWindowPos,来实现使窗体置前的功能
'利用代码连接数据库
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_kcgl.mdb;Persist Security Info=False"
 Option1.Value = True
 Adodc1.RecordSource = "select * from tb_enter order by M_ID"
 Adodc1.Refresh
  If Adodc1.Recordset.RecordCount > 0 Then
    Do While Adodc1.Recordset.EOF = False          '将操作员信息添加到Combo1控件当中
       Combo1.AddItem (Adodc1.Recordset.Fields("M_Name"))
       Adodc1.Recordset.MoveNext
    Loop
  End If
End Sub
Private Sub Option1_Click()
Frame2.Visible = True
Frame1.Visible = False
Command1.Visible = True
Command2.Visible = False
End Sub

Private Sub Option2_Click()
Frame1.Visible = True
Frame2.Visible = False
Command2.Visible = True
Command1.Visible = False
Combo1.SetFocus
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text2.SetFocus
Else
End If
End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then          '如果按下的是回车键,则光标落到文本框当中
Text3.SetFocus
Else
End If
End Sub

Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = 13 Then         '如果按下的是回车键,则光标落到文本框当中
   Text4.SetFocus
 Else
 End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
 If KeyCode = 13 Then
    Call Command1_Click
 Else
 End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
   frm_main.Enabled = True
End Sub

⌨️ 快捷键说明

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