' This section is used to check if you have entered a user name or password
If IsNull (Trim (me.username)) Then
Docmd.beep
MsgBox ("Please enter user name!")
Else
If IsNull (Trim (Me.password)) Then
Docmd.beep
MsgBox ("Please enter your password!")
Else
' The following is used to compare the [landing table]
Me.RecordSource = "SELECT * from login table where user name = '" & Me.username & "' and password = '" & Me.password & "'"
' Set rs = getrs (str)
If Me.Recordset.EOF Then
Docmd.beep
MsgBox ("No this user or password is wrong, please re-enter!")
Me. Username = ""
Me. Password = ""
Me. Username. SetFocus
Exit Sub
Else
DoCmd.Close
' Trial Version usage limit
If n =
DoCmd.Close
Else
n = n + 1
MsgBox ("Welcome to use Chengde County cadre management system!")
Check = True ' Set login flag
DoCmd.OpenForm ("Main Query form")
End If
End If
End If
Access Login Check Code two