R
Rillo
My objective is to
a. Open a form on which the user is asked to enter a password
b. check the password
c. if the password is OK, close the form on which the password is entered
and open the next form
d. if the password is incorrect, display a message, and allow the user to
try again
I created a form called PASSWORD. I also have a table (LetMeIN) with one
record containing a record number (key field) and the valid password in a
field called “Passwordâ€
The reason the password is held in a table is that I can change it
periodically.
The PASSWORD form contains a text box (unbound) and a command button as
follows:
• Text box “Enter Password†– user enters password here
• Command Button – user clicks to proceed
I am somewhat of a novice when it comes to Access Visual Basic.
However, by “borrowing†code, my attempt at achieving my objective is shown
below.
The code only works if I change
If Me.ThePassword.Value = DLookup("Password", "tblLetMeIn) Then
To
If Me.ThePassword.Value = “123456†Then
(where 123456 is the current password)
By the way, does anybody know where I could obtain a book that would help me
understand Access Basic, preferably a book containing examples!
Here is my code, for what it is worth (the code is linked to the OnClick
event on the command button.
I am using Access 2003.
___________________________________________________________________
Private Sub Get_Into_System_Click()
'Check to see if data is entered into the password box
If IsNull(Me.ThePassword) Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.ThePassword.SetFocus
Exit Sub
End If
'Check value of password in LetMeIN table to see if this
'matches value entered on PASSWORD form
If Me.ThePassword.Value = "THENVAA" Then
' If Me.ThePassword.Value = DLookup([CurrentPassword], "tblLetMeIn",
‘ "[RecNo] = 1") Then
'Close logon form and open Reminder CD screen
DoCmd.Close acForm, "PASSWORD", acSaveNo
DoCmd.OpenForm "Reminder re CD"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
'Me.ThePassword.SetFocus
End If
End Sub
a. Open a form on which the user is asked to enter a password
b. check the password
c. if the password is OK, close the form on which the password is entered
and open the next form
d. if the password is incorrect, display a message, and allow the user to
try again
I created a form called PASSWORD. I also have a table (LetMeIN) with one
record containing a record number (key field) and the valid password in a
field called “Passwordâ€
The reason the password is held in a table is that I can change it
periodically.
The PASSWORD form contains a text box (unbound) and a command button as
follows:
• Text box “Enter Password†– user enters password here
• Command Button – user clicks to proceed
I am somewhat of a novice when it comes to Access Visual Basic.
However, by “borrowing†code, my attempt at achieving my objective is shown
below.
The code only works if I change
If Me.ThePassword.Value = DLookup("Password", "tblLetMeIn) Then
To
If Me.ThePassword.Value = “123456†Then
(where 123456 is the current password)
By the way, does anybody know where I could obtain a book that would help me
understand Access Basic, preferably a book containing examples!
Here is my code, for what it is worth (the code is linked to the OnClick
event on the command button.
I am using Access 2003.
___________________________________________________________________
Private Sub Get_Into_System_Click()
'Check to see if data is entered into the password box
If IsNull(Me.ThePassword) Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.ThePassword.SetFocus
Exit Sub
End If
'Check value of password in LetMeIN table to see if this
'matches value entered on PASSWORD form
If Me.ThePassword.Value = "THENVAA" Then
' If Me.ThePassword.Value = DLookup([CurrentPassword], "tblLetMeIn",
‘ "[RecNo] = 1") Then
'Close logon form and open Reminder CD screen
DoCmd.Close acForm, "PASSWORD", acSaveNo
DoCmd.OpenForm "Reminder re CD"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, _
"Invalid Entry!"
'Me.ThePassword.SetFocus
End If
End Sub