Hi group.
I can't get a part of coding to work. It's for a Log in part of a
system. So far it all work, apart from the last part. Where the
number of bad passwords are counted, and when there's 3 bad passwords
.....then the database should shut down.
This is the coding.
++++++++++++++++++++++++++++++++++++++++++++
Private Sub cmdLogin_Click()
'This checks that a User Name has been selected in the combobox
If IsNull(Me.Employee) Or Me.Employee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.Employee.SetFocus
Exit Sub
End If
'Check to see that data has been entered in the password box
If IsNull(Me.Password) Or Me.Password = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.Password.SetFocus
Exit Sub
End If
'Compares the typed password to the one in the table
If Me.Password.Value = DLookup("[Log Pwd]", "Log In TBL", "[Log ID]="
& Me.Employee.Value) Then
'Close logon form and open Welcome form
DoCmd.Close acForm, "LogIn", acSaveNo
DoCmd.OpenForm "Welcome Frm"
'Otherwise if password is wrong
'then say, Password Invalid
'And set focus to password field
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid
Entry!"
Me.Password.SetFocus
intLogInAttempts = intLogInAttempts + 1
End If
'If User Enters incorrect password 3 times
'Database will quit
If intLogInAttempts > 3 Then
MsgBox "You have entered the wrong password 3 times. Database will
now shut down. Please contact admin", vbCritical, "Restricted
Access!"
Application.Quit
End If
End Sub
++++++++++++++++++++++++++++++++++++++++++++
The "intLogInAttempts = intLogInAttempts + 1" line, and everything
after doesn't seem to work.
Would be grateful for any help.
Pretty Please! 2 2683
Where and how is the variable 'intLogInAttempts' declared? I don't see the
declaration anywhere in the code you posted.
If you declare it within the procedure using the Static keyword, it should
work ...
Private Sub cmdLogin_Click()
Static intLogInAttempts As Integer
'etc.
See the help topic on the 'Static' keyword for more information.
--
Brendan Reynolds
"IronMan" <Th********@yahoo.com> wrote in message
news:ce**************************@posting.google.c om... Hi group.
I can't get a part of coding to work. It's for a Log in part of a system. So far it all work, apart from the last part. Where the number of bad passwords are counted, and when there's 3 bad passwords ....then the database should shut down.
This is the coding.
++++++++++++++++++++++++++++++++++++++++++++
Private Sub cmdLogin_Click()
'This checks that a User Name has been selected in the combobox
If IsNull(Me.Employee) Or Me.Employee = "" Then MsgBox "You must enter a User Name.", vbOKOnly, "Required Data" Me.Employee.SetFocus Exit Sub End If
'Check to see that data has been entered in the password box
If IsNull(Me.Password) Or Me.Password = "" Then MsgBox "You must enter a Password.", vbOKOnly, "Required Data" Me.Password.SetFocus Exit Sub End If
'Compares the typed password to the one in the table
If Me.Password.Value = DLookup("[Log Pwd]", "Log In TBL", "[Log ID]=" & Me.Employee.Value) Then
'Close logon form and open Welcome form
DoCmd.Close acForm, "LogIn", acSaveNo DoCmd.OpenForm "Welcome Frm"
'Otherwise if password is wrong 'then say, Password Invalid 'And set focus to password field
Else MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!" Me.Password.SetFocus intLogInAttempts = intLogInAttempts + 1 End If
'If User Enters incorrect password 3 times 'Database will quit
If intLogInAttempts > 3 Then MsgBox "You have entered the wrong password 3 times. Database will now shut down. Please contact admin", vbCritical, "Restricted Access!" Application.Quit End If
End Sub
++++++++++++++++++++++++++++++++++++++++++++
The "intLogInAttempts = intLogInAttempts + 1" line, and everything after doesn't seem to work.
Would be grateful for any help.
Pretty Please!
What do you mean by "dosen't work"? Do you get an error message? I don't see
a variable declaration for intLogInAttempts, so I'm not sure how it's
datatype is being handled.
Mike Storr www.veraccess.com
"IronMan" <Th********@yahoo.com> wrote in message
news:ce**************************@posting.google.c om... Hi group.
The "intLogInAttempts = intLogInAttempts + 1" line, and everything after doesn't seem to work.
Would be grateful for any help.
Pretty Please! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Florian Lindner |
last post by:
Hello,
I've a scripts that allows limited manipulation of a database to users. This
script of course needs to save a password for the database connection. The
users, on the other hand need read...
|
by: Miranda |
last post by:
Hi, I have a ASP/vbscript program that generates random passwords. The
problem is I need to insert those passwords into an Access database of
327 clients.
I have the random password program...
|
by: Peter Rilling |
last post by:
How does Windows store passwords that it uses? For instance, when you
install a service, you can provide it the username and password. This
information is stored somehow so that at a later date...
|
by: Shapper |
last post by:
Hello,
I created a login system and I my passwords are being hashed.
I need to check if everything is working so I need to generate some
hashed passwords to replace the actual passwords I have...
|
by: Dino Vliet |
last post by:
Hi folks,
probably this is a question you've heard so many times
but I wasn't able to find a solution to it.
I'm using a shell script to create a textfile for me.
It looks like...
|
by: Macca |
last post by:
Hi,
My application uses passwords to limit access to certain parts of the app. I
was considering storing these in my database but have heard that there can be
problems with this. I have heard...
|
by: Cord-Heinrich Pahlmann |
last post by:
Hi,
I have written a tool wich de/encrypts a few of my forum and
bloggin-Passwords.
My question is how secure it is.
The following describes how I have encrypted my passwords.
When I log in,...
|
by: Simon.Whiteside |
last post by:
If someone has created a database for me and transferred it over is
there any way that I can check I have full access to all areas?
I am a beginner with Access and so the development has been...
|
by: snowinfo |
last post by:
Hi all,
any way to count the number of users i have logged into my site?
any help/code appreciated,
craig
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |