G
Guest
Hello,
I would like to have a form displayed (prior to the swtichboard appearing)
that requires the user to enter his/her login information and then click
enter. If the information is correct, the switchboard screen will appear and
the login form will disappear. If not, then a message box appears and the
user has to try again or they won't receive access to the other forms.
I have created a table called Login. This table contains the username and
password. Next I designed a form that will allow the user to type his/her
username and password and then click on the login button.
My code is below however I do not know what I'm doing wrong. Number 1, I'm
not sure how to determine the correct name for the forms when writing the
code (i.e. frame.framename or form.formname, etc).
Private Sub Command10_Click() ->the enter button
'check for correct user name
If Text7 = "nixcynt" Then
'check for correct password
If Text3 = "lookout" Then
'place code to here to pass the
'success to the calling sub
'setting a global var is the easiest
LoginSucceeded = True
'Me.Hide
'frmMenu.fraMain.Visible = True
'frmMenu.fraLogin.Visible = False
DoCmd.OpenForm "Switchboard", acNormal, "", "", , acNormal
Text3_Exit_Exit:
Exit Sub
Text3_Exit_Err:
MsgBox Error$
Resume Text3_Exit_Exit
Else
MsgBox "Invalid UserName/Password. Please try again!", , "Login"
Text3.SetFocus
SendKeys "{Home}+{End}"
End If
Else
MsgBox "Invalid UserName/Password. Please Try Again!"
End If
End Sub
I would like to have a form displayed (prior to the swtichboard appearing)
that requires the user to enter his/her login information and then click
enter. If the information is correct, the switchboard screen will appear and
the login form will disappear. If not, then a message box appears and the
user has to try again or they won't receive access to the other forms.
I have created a table called Login. This table contains the username and
password. Next I designed a form that will allow the user to type his/her
username and password and then click on the login button.
My code is below however I do not know what I'm doing wrong. Number 1, I'm
not sure how to determine the correct name for the forms when writing the
code (i.e. frame.framename or form.formname, etc).
Private Sub Command10_Click() ->the enter button
'check for correct user name
If Text7 = "nixcynt" Then
'check for correct password
If Text3 = "lookout" Then
'place code to here to pass the
'success to the calling sub
'setting a global var is the easiest
LoginSucceeded = True
'Me.Hide
'frmMenu.fraMain.Visible = True
'frmMenu.fraLogin.Visible = False
DoCmd.OpenForm "Switchboard", acNormal, "", "", , acNormal
Text3_Exit_Exit:
Exit Sub
Text3_Exit_Err:
MsgBox Error$
Resume Text3_Exit_Exit
Else
MsgBox "Invalid UserName/Password. Please try again!", , "Login"
Text3.SetFocus
SendKeys "{Home}+{End}"
End If
Else
MsgBox "Invalid UserName/Password. Please Try Again!"
End If
End Sub