📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form frmNew
BackColor = &H00C0FFC0&
BorderStyle = 4 'Fixed ToolWindow
Caption = "开户"
ClientHeight = 4335
ClientLeft = 45
ClientTop = 315
ClientWidth = 6060
LinkTopic = "Form2"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4335
ScaleWidth = 6060
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command2
Caption = "返 回"
Height = 495
Left = 3240
TabIndex = 9
Top = 3480
Width = 1335
End
Begin VB.CommandButton Command1
BackColor = &H00C0C0C0&
Caption = "提 交"
Height = 495
Left = 960
TabIndex = 8
Top = 3480
Width = 1335
End
Begin VB.TextBox Text1
Height = 375
Left = 2280
TabIndex = 7
Top = 2640
Width = 2415
End
Begin VB.TextBox txtPass2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 5
Top = 2040
Width = 2415
End
Begin VB.TextBox txtPass1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 3
Top = 1320
Width = 2415
End
Begin VB.TextBox txtName
Height = 495
Left = 2280
TabIndex = 1
Top = 240
Width = 2415
End
Begin VB.Label Label5
BackColor = &H00C0FFC0&
Caption = "建议密码不要少于6位,只能使用数字。"
Height = 255
Left = 840
TabIndex = 10
Top = 840
Width = 3975
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
Caption = "开户金额 :"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 6
Top = 2760
Width = 1215
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
Caption = "请确认密码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 480
TabIndex = 4
Top = 2160
Width = 1575
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
Caption = "请输入密码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 2
Top = 1440
Width = 1455
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
BackColor = &H00C0FFC0&
Caption = "请输入用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 0
Top = 360
Width = 1575
End
End
Attribute VB_Name = "frmNew"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As Database '设置变量
Dim rs1 As Recordset
Dim rs2 As Recordset
Dim t As Date
Private Sub Command1_Click() '提交资料按钮
Dim response
If txtPass1.Text <> txtPass2.Text Then '两次密码不一致
MsgBox "两次输入的密码不一致,请重新输入!", vbOKOnly + vbInformation, "错误"
txtPass1.Text = ""
txtPass2.Text = ""
txtPass1.SetFocus
Else '查找申请用户名是否已经存在
newName = txtName.Text
newpass = Val(txtPass1.Text)
newmoney = Text1.Text
newtime = Now
Set db = OpenDatabase(App.Path + "/cw.mdb")
NameQuery = txtName.Text
rs1.MoveFirst
Do Until rs1.EOF
If rs1.Fields("用户名") Like LCase(NameQuery) Then '用户名存在,不能注册
MsgBox "此用户名已被使用,请重新选择一个!", vbOKOnly + vbInformation, "出错"
txtName.Text = ""
txtPass1.Text = ""
txtPass2.Text = ""
Exit Sub
Else '可以注册
rs1.MoveNext
End If
Loop
With rs1
.AddNew
!用户名 = LCase(newName)
!密码 = LCase(newpass)
.Update
End With
With rs2
.AddNew
!用户名 = LCase(newName)
!帐户余额 = LCase(newmoney)
!存款 = LCase(newmoney)
!日期 = LCase(newtime)
!日积数 = 0
.Update
End With
rs1.MoveLast
newid = rs1!ID
response = MsgBox(newName & "已经成功开户!" & "你的ID是" & newid, vbOKOnly, "提示") '成功提醒
If response = 1 Then
Unload Me
frmFirst.txtName.Text = ""
frmFirst.txtPass.Text = ""
frmFirst.Show '回到登陆界面进行登陆
End If
End If
End Sub
Private Sub Command2_Click() '返回按钮
frmFirst.txtName.Text = ""
frmFirst.txtPass.Text = ""
frmFirst.Show
Hide
End Sub
Private Sub Form_Load() '窗体加载
Set db = OpenDatabase(App.Path + "/cw.mdb")
Set rs1 = db.OpenRecordset("SELECT * FROM Person")
Set rs2 = db.OpenRecordset("SELECT * FROM PersonCount")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -