Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looop

Status
Not open for further replies.

oakeyes

Programmer
Oct 26, 2000
36
AE
I have a control block with a control item that allows the user to enter a concealed password. If the user enters the correct password he enters another block, if not he is allowed 3 chances to enter the password, if the third chance passes without entering the correct password, he gets access denied message and and the application gets closed. The problem is how to use loops to do this. I used both for loop and loop method but they display the access denied message three times consequently instead without giving me chance to enterpassword for the second time. If possible, attach a sample code. Thanx
 
Oakeyes -

I think the following logic is what you are looking for:

.
.
.
v_correct := FALSE;
i := 0;
WHILE ((v_correct = FALSE) AND (i <3)) LOOP
<PROMPT FOR PASSWORD>
<ACCEPT PASSWORD>
IF <password correct> THEN
v_correct := TRUE;
ELSE
i := i + 1;
END LOOP;

IF (v_correct = TRUE) THEN
<go to next block>
ELSE
<kick user out>
END IF;
 
Sorry - the above code was slightly wrong (forgot an END IF!). I think THIS is alright:

v_correct := FALSE;
i := 0;
WHILE ((v_correct = FALSE) AND (i <3)) LOOP
<PROMPT FOR PASSWORD>
<ACCEPT PASSWORD>
IF <password correct> THEN
v_correct := TRUE;
ELSE
i := i + 1;
END IF;
END LOOP;

IF (v_correct = TRUE) THEN
<go to next block>
ELSE
<kick user out>
END IF;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top