📄 form5.frm
字号:
VERSION 5.00
Begin VB.Form Form5
Caption = "添加新用户"
ClientHeight = 2430
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form5"
ScaleHeight = 2430
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取 消"
Height = 375
Left = 2520
TabIndex = 5
Top = 1800
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "添 加"
Height = 375
Left = 960
TabIndex = 4
Top = 1800
Width = 975
End
Begin VB.TextBox Text2
Height = 375
Left = 1680
TabIndex = 3
Top = 960
Width = 2295
End
Begin VB.TextBox Text1
Height = 375
Left = 1680
TabIndex = 1
Top = 240
Width = 2295
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "新用户密码:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 120
TabIndex = 2
Top = 960
Width = 1575
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "新用户名:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 120
TabIndex = 0
Top = 240
Width = 1335
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As Database
Dim mm As Recordset
Private Sub Command1_Click()
newname = Text1.Text
NewPassword = Text2.Text
With mm
.AddNew
!Name = LCase(newname)
!Password = LCase(NewPassword)
.Update
End With
On Error Resume Next
mm.MoveLast
Text1 = mm.Fields("name")
Text2 = mm.Fields("password")
'MsgBox (newName & "was added to the address book")
If MsgBox("是否添加下一条记录!", vbOKCancel) = vbOK Then
Text1.Text = ""
Text2.Text = ""
Else
GoTo ine
End If
ine:
End Sub
Private Sub Command2_Click()
Me.Hide
End Sub
Private Sub Form_Load()
Set db = OpenDatabase(App.Path & "\用户密码")
Set mm = db.OpenRecordset("mm")
If mm.EOF Then
MsgBox "请添加新用户"
Else
mm.MoveFirst
Text1 = ""
Text2 = ""
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -