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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password Verification, Using InputBox

Status
Not open for further replies.

darinmc

Technical User
Feb 27, 2005
171
GB
Hi
I Have this code on form load, if the record is not found, i need the form to refresh or reload, forcing the inputbox to open and start the form load from the beginning UNTIL the right password is found.
It would be good if the procedure was only allowed 3 times before closing the database???

I have tried, Recalc, Refresh, requery after the else, but none work...

The reason for this method, is so that the user cannot change menu setting until logged in...

Code:
Private Sub Form_Load()
Dim Message, Title2, Default, MyValue
Message = "Enter a value between 1 and 3"    ' Set prompt.
Title = "InputBox Demo"    ' Set title.
Default = ""   ' Set default.

MyValue = InputBox(Message, Title2, Default)
Me.tPassword = MyValue

Dim dbs As Database
Dim rst As Recordset
Dim Found As Boolean
Dim sql As String
Dim ctl As Control
Set dbs = CurrentDb


Set rst = dbs.OpenRecordset("tblPassword")

rst.MoveFirst
While Not Found And Not rst.EOF
If Me.tPassword = rst!Password Then
Found = True
Else
rst.MoveNext
End If
Wend

If Found Then
Me.cmdEnterPass.SetFocus
Else
Me.Form.Requery
End If

Set rst = Nothing
Set dbs = Nothing

End Sub

Please can you HeLp
Thx Darin
 
I suddenly remembered that u cant use ***** in the inputbox format, or can u?

If not, then i would like to use a form that opens, which i already have
BUT
is it possible that the menu BARS at the top NOT BE ACCESSED until the correct password has been entered???

Thx Darin
 
thx, all solved.......

by making the form modal AND popup, then everything is locked out.

Darin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top