If Text1.Text = "username" And Text2.Text = "password" Then '帐号为username,密码为password
MsgBox "输入正确", vbInformation, "提示"
Unload Me
Form2.Show
Else
MsgBox "帐号或密码错误", vbCritical, "提示"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Command1.Caption = "登陆"
End Sub
打开数据库资料表内的("用户名称")和("用户密码")
栏位里面直接改就可以了。
或写一个新增用户名称和用户密码的程式。
比如:
数据库=login.mdb
资料表=user
栏位名=username
和
password
Private
Sub
Command1_Click()
Data1.Recordset.AddNew
Data1.Recordset.Fields("username")
=
Text1.Text
Data1.Recordset.Fields("password")
=
Text2.Text
Data1.Recordset.Update
Data1.Refresh
MsgBox
"成功存取",
vbOKOnly
+
vbInformation
End
Sub
Private
Sub
Form_Load()
Data1.DatabaseName
=
App.Path
&
"\login.mdb"
Data1.RecordSource
=
"user"
End
Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)