I tried using the code from the code bank to password protect a form. However when I type in the wrong password it still lets me into the form.
This is the code I'm using
Private Sub Form_Open(Cancel As Integer)
Dim user As String
Dim pwd As String
user = InputBox("username")
pwd = InputBox("Password")
If pwd = "password" And user = "user" Then
MsgBox "Access Granted"
MsgBox "Incorrect Login"
I need it to close the form if the password or user name is wrong