Hi Guys,
I have some code listed below, which finds the correct cells and password. the problem is that i can not quite get the logic order correct. this is what should happen.
User enters their login details, if their details are not on the sheet then msgbox"nothing found". If the user is on the system but password wrong, then msgbox "Wrong Password". If username and password correct then check if first login and if so run userform passwordchange. If not first login then load the userform for that user.
a sample of the worksheet would be
A.............. B................C................ D............. E............. F
UserId.....firstname....2ndname......load menu.....Password....1st login
zz12345........John.......Smith........... Admin........anypass......Yes
(Sorry at work can not use htmlmaker)
The passwordchange userform will change the 1st login to No.
I dont think i am far away with this one, i just can not seem to get the IF order correct.
Any Help would be great.
Thanks in advance.
Ally.
I have some code listed below, which finds the correct cells and password. the problem is that i can not quite get the logic order correct. this is what should happen.
User enters their login details, if their details are not on the sheet then msgbox"nothing found". If the user is on the system but password wrong, then msgbox "Wrong Password". If username and password correct then check if first login and if so run userform passwordchange. If not first login then load the userform for that user.
a sample of the worksheet would be
A.............. B................C................ D............. E............. F
UserId.....firstname....2ndname......load menu.....Password....1st login
zz12345........John.......Smith........... Admin........anypass......Yes
(Sorry at work can not use htmlmaker)
The passwordchange userform will change the 1st login to No.
Code:
Private Sub CommandButton2_Click()
Dim FindString As String
Dim Rng As Range
'
FindString = TextBox1.Value
If Trim(FindString) <> "" Then
With Sheets("User_Access").Range("A:A")
'
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If TextBox2.Value = Rng.Offset(, 4) Then
MsgBox "Welcome " & Rng.Offset(, 1) & vbCr & " Password Correct"
Load AdminMaster
AdminMaster.Show
Else
MsgBox "Wrong Password" & vbCr & "Please Try Again!!"
TextBox1.Value = ""
TextBox2.Value = ""
If Rng.Offset(, 5) = "yes" Then
MsgBox "This is your first login " & vbCr & vbCr & "Please Reset Your Password"
Load passwordchange
passwordchange.Show
If Not Rng Is Nothing Then
Application.Goto Rng, True
MsgBox "Nothing found"
End If
End If
End If
End With
End If
End Sub
I dont think i am far away with this one, i just can not seem to get the IF order correct.
Any Help would be great.
Thanks in advance.
Ally.