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

📄 frmadduser.frm

📁 对家庭的开支有一个全面的了解和统计
💻 FRM
字号:
VERSION 5.00
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form frmadduser 
   Caption         =   "增加新用户"
   ClientHeight    =   3345
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3330
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   3345
   ScaleWidth      =   3330
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdcancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   1140
      TabIndex        =   6
      Top             =   2520
      Width           =   855
   End
   Begin VB.CommandButton cmdexit 
      Caption         =   "退出"
      Height          =   375
      Left            =   2160
      TabIndex        =   5
      Top             =   2520
      Width           =   855
   End
   Begin VB.CommandButton cmdok 
      Caption         =   "确认"
      Height          =   375
      Left            =   120
      TabIndex        =   4
      Top             =   2520
      Width           =   855
   End
   Begin MSMask.MaskEdBox Maskorder 
      Height          =   375
      Left            =   1080
      TabIndex        =   7
      ToolTipText     =   "四位数的编码"
      Top             =   120
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   661
      _Version        =   393216
      MaxLength       =   4
      Mask            =   "10##"
      PromptChar      =   "_"
   End
   Begin VB.TextBox txtrepassword 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1080
      PasswordChar    =   "*"
      TabIndex        =   3
      Top             =   2040
      Width           =   1455
   End
   Begin VB.TextBox txtpassword 
      Height          =   375
      IMEMode         =   3  'DISABLE
      Left            =   1080
      PasswordChar    =   "*"
      TabIndex        =   2
      Top             =   1380
      Width           =   1455
   End
   Begin VB.TextBox txtname 
      Height          =   375
      Left            =   1080
      TabIndex        =   1
      Top             =   720
      Width           =   1455
   End
   Begin VB.Label Label5 
      Height          =   255
      Left            =   480
      TabIndex        =   11
      Top             =   3000
      Width           =   2295
   End
   Begin VB.Label Label4 
      Caption         =   "确认密码:"
      Height          =   255
      Left            =   120
      TabIndex        =   10
      Top             =   2160
      Width           =   975
   End
   Begin VB.Label Label3 
      Caption         =   "用户密码:"
      Height          =   255
      Left            =   120
      TabIndex        =   9
      Top             =   1485
      Width           =   975
   End
   Begin VB.Label Label2 
      Caption         =   "用户姓名:"
      Height          =   255
      Left            =   120
      TabIndex        =   8
      Top             =   795
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "用户编号:"
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   975
   End
End
Attribute VB_Name = "frmadduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As Database
Dim rs As Recordset
Dim rsorder As Recordset
Dim neworder As Integer
Dim newusename As String
Dim newpassword1 As String
Dim newpassword2 As String

Private Sub cmdcancel_Click()
     Maskorder.SetFocus
     'Set Maskorder.Text = "10__"
     txtname.Text = ""
     txtpassword.Text = ""
     txtrepassword.Text = ""
End Sub

Private Sub cmdexit_Click()
Unload Me
frmmain.Show
End Sub

Private Sub cmdok_Click()
'If Len(Maskorder.Text) <> 4 Then
 '  MsgBox "编号长度不够,请输入四位数的编码!", vbOKOnly + vbExclamation, "提示"
'End If

 If Trim(rs.Fields(0)) = Trim(Maskorder.Text) Then
     MsgBox "编号已经存在,请重新输入新编号!", vbOKOnly + vbInformation, "提示"
     Maskorder.SetFocus
     'Set Maskorder.Text = "10__"
     
     txtname.Text = ""
     txtpassword.Text = ""
     txtrepassword.Text = ""
     Exit Sub
 End If
 
 If Trim(rs.Fields(1)) = Trim(txtname.Text) Then
     MsgBox "用户名已经存在,请重新输入新用户名!", vbOKOnly + vbInformation, "提示"
     txtname.SetFocus
   '  Maskorder.Text = ""
     txtname.Text = ""
     txtpassword.Text = ""
     txtrepassword.Text = ""
     Exit Sub
 End If
 
neworder = Trim$(Maskorder.Text)
newusename = Trim$(txtname.Text)
newpassword1 = Trim$(txtpassword.Text)
newpassword2 = Trim$(txtrepassword.Text)

If txtname.Text = "" Then
   MsgBox "用户名不能为空,请输入!", vbOKOnly + vbExclamation, "提示"
   Exit Sub
End If
If Trim$(newpassword1) <> Trim$(newpassword2) Then
   MsgBox "两次输入的密码不同,请重新输入", vbOKOnly + vbExclamation, "密码不同"
   txtpassword.SetFocus
   txtpassword.Text = ""
   txtrepassword.Text = ""
   Exit Sub
End If
With rs
.addnew
!user_Order = neworder
!user_name = newusename
!user_password = newpassword1
.Update
End With
MsgBox "你已经成功地添加了该用户!", vbOKOnly + vbInformation, "提示"
   txtname.Text = ""
   txtpassword.Text = ""
   txtrepassword.Text = ""
End Sub

Private Sub Form_Load()
Set db = OpenDatabase(App.Path & "\payout.mdb")
Set rs = db.OpenRecordset("user")
rs.MoveLast
Dim order As String

Maskorder.SelText = "100" & (rs.RecordCount) + 1

rs.Index = "user_order"
Label5.Caption = "数据库中已有:" & (rs.RecordCount) & "个用户。"
End Sub

Private Sub Form_Unload(Cancel As Integer)
frmmain.Show
End Sub


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

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

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

End Sub

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

End Sub

⌨️ 快捷键说明

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