I am looking for a way to create a login access to a specific MS Access form. I have multiple forms in the ms access database but one of the forms must be visible to only one particular user. To this particular form in MS Access I want to create a login window. Any help to create such functionality is much appreciated. Thank you in advance!
I would implement an additional form in the Microsoft Access database and manage its visibility depending on the user's authentication status. Additionally, I would apply security measures, such as locking the project to prevent unauthorized access to the VBA code.
Private Sub LoginButton_Click()
' check user name from your user DB
username = DLookup("yourUsernameField", "yourUserTable", "[yourUsernameField] = '" & Forms!yourLoginForm!TextBox & "'")
If username = Forms!yourLoginForm!TextBox Then
' Replace From with the name of the form you want to restrict access to
DoCmd.OpenForm "formForResticted"
DoCmd.Close acForm, "formForNormal""
End If
End Sub