|
-
Jun 20th, 2007, 05:01 PM
#1
Re: password problem
Fixing the problem of the form loading and allowing 3 more tries is just a scope problem. But you have to decide whether the user has to close the whole program to try again, or whether you're going to allow it to work the way it does now. You can't stop one user from trying to log in after 3 tries, but allow another user to try to log in at that point - the computer doesn't know who's typing.
To keep the program from allowing more than 3 tries, define your counter variable in a module
Code:
Public intCounter As Integer
In the code where you show the login window (probably frmMain)
Code:
If intCounter < 3 Then
frmLogin.Show 'use whatever the real form name is
Else
MsgBox "Sorry, you've had 3 tries.",vbCritical
End If
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jun 20th, 2007, 06:58 PM
#2
New Member
Re: password problem
option explicit
Static cntr as Integer
Private Sub OKBtn_Click()
Dim db as Database ---for your database
Dim rs as Recordset - for password table
Set db=... open your db
set rs=... open the password table and look for the username
if not rs.BOF then '... if it exist
if rs!password=txtpassword.text Then '...if password is correct
unload me
frmMenu.Show
else
msgbox "Access denied.",vbExclamation,"Warning"
cntr=cntr + 1
end if
else
msgbox "Access denied.",vbExclamation,"Warning"
cntr=cntr + 1
end if
counterResult:
if cntr = 3 then
...put here whatever your condition is.
cntr = 0
end if
End Sub
Hope it could help or give you an idea...hekhek
regards:
jireh
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|