首页 > 技术文章 > access登录校验代码二

ince 2018-05-01 10:34 原文

‘ 这一段是用来检查有没有输入用户名或密码的
If IsNull(Trim(Me.username )) Then
DoCmd.Beep
MsgBox ("请输入用户名称! ")
Else
If IsNull(Trim(Me.password )) Then
DoCmd.Beep
MsgBox ("请输入密码! ")
Else
‘ 以下是用来与[登陆表]做对比的
Me.RecordSource = "select * from 登陆表 where 用户名 = '" & Me.username & "' and 密码 ='" & Me.password & "'"
'Set rs = GetRS(str)
If Me.Recordset.EOF Then
DoCmd.Beep
MsgBox ("没有这个用户或密码有误 , 请重新输入! ")
Me. username = ""
Me. password = ""
Me. username .SetFocus
Exit Sub
Else
DoCmd.Close
‘ 试用版使用次数的限制
If n = 50 Then
DoCmd.Close
Else
n = n + 1
MsgBox ("欢迎使用承德县干部管理系统! ")
check = True ' 设置登陆标志
DoCmd.OpenForm ("主查询窗体 ")
End If
End If
End If

推荐阅读