Article View: comp.lang.basic.visual.misc
Article #353HELP! I need a loop! Can't figure this...
From: MikeG in Philly
Date: Sat, 11 Mar 2000 00:00
Date: Sat, 11 Mar 2000 00:00
59 lines
2370 bytes
2370 bytes
Hi Folks: the following code snippet is a loop for a password, and it works
fine as it is...but I need to give the user three tries before exiting the
sub and can't figure out the loop...can you help?
Here's the code...
Private Sub cmdOK_Click()
Dim strLName As String
Dim strPW1 As String
Dim strLevel As String
intCount = intCount + 1
Open "a:\password.dat" For Input As #1
Do While Not EOF(1)
Input #1, strLName, strPW1, strLevel
If LCase(Trim(strLName)) = LCase(Trim(txtUserName.Text)) And
LCase(Trim(strPW1)) = LCase(Trim(txtPassword.Text)) And
LCase(Trim(strLevel)) = 3 Then
frmMain.Show
Me.Hide
Close #1
Exit Sub
Else
If LCase(Trim(strLName)) = LCase(Trim(txtUserName.Text)) And
LCase(Trim(strPW1)) = LCase(Trim(txtPassword.Text)) And
LCase(Trim(strLevel)) = 2 Then
Me.Hide
frmMain.Show
frmMain.cmdAssign.Visible = False
frmTables.cmdOrders.Visible = False
frmTables.cmdOL.Visible = False
frmTables.cmdPurch.Visible = False
frmTables.cmdCR.Visible = False
Close #1
Exit Sub
Else
If LCase(Trim(strLName)) = LCase(Trim(txtUserName.Text)) And
LCase(Trim(strPW1)) = LCase(Trim(txtPassword.Text)) And
LCase(Trim(strLevel)) = 1 Then
Me.Hide
frmMain.cmdView.Visible = False
frmMain.Show
Close #1
Exit Sub
End If
End If
End If
Loop
Close #1
MsgBox "Sorry, wrong password."
End Sub
Technical Details
Message-ID:
<38cae00b@news3.enter.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 110e3b,4281b5412007ec6b,start X-Google-Attributes: gid110e3b,public X-Google-Thread: 108062,4281b5412007ec6b,start X-Google-Attributes: gid108062,public From: "MikeG in Philly" <PhilaPA@hotmail.com> Subject: HELP! I need a loop! Can't figure this... Date: 2000/03/11 Message-ID: <38cae00b@news3.enter.net> X-Deja-AN: 596262606 X-Original-NNTP-Posting-Host: mat-1-11.enter.net X-Trace: 11 Mar 2000 19:08:43 -0500, mat-1-11.enter.net Organization: Enter.Net X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: comp.lang.basic.visual.misc,cz.comp.lang.basic.visual X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600