Forum Discussion
Andrew_Kaplan
Oct 27, 2020Copper Contributor
Several questions regarding a login form in Access 2016
Hello – I am in the process of setting up user logins for an Access 2016 database. The article that I am using to accomplish this task is the following: https://www.datanumen.com/blogs/how-to-p...
Woldman
Oct 28, 2020Iron Contributor
You can realize the second issue with adding a DoCmd.OpenForm statement to the Else branch (I added only the last part of the cmd_Login_Click routine):
...
If rst.EOF Then
MsgBox prompt:="Incorrect username/password. Try again.", buttons:=vbCritical, title:="Login Error"
Me.txt_username.SetFocus
Else
MsgBox prompt:="Hello, " & rst.Fields(0).Value & ".", buttons:=vbOKOnly, title:="Login Successful"
DoCmd.Close acForm, "frm_login", acSaveYes
DoCmd.OpenForm "Name of the Form You Want to be Opened"
End If
Set db = Nothing
Set rst = Nothing
End Sub
Good luck!
Tieme
- kaplan71Oct 28, 2020Copper Contributor
Hello --
That did the trick.
Thanks.