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...
Please can you HeLp
Thx Darin
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