i have created a database using excel and i have to set a security level i have written all of the vba code correctly i think but it just does seem to work properly. here is the code below if anyone could point out any problems with it would be much appreciated.
Code:
Private Sub Login_Click()
Dim name, password, found, loops
found = 0
loops = 0
name = Range("Username").Value
password = Range("Password").Value
Worksheets("Data").Visible = True
Worksheets("Data").Select
ActiveSheet.Range("A1").Activate
While ActiveCell.Offset(loops, 0).Value <> "" And found = 0
If Username = ActiveCell.Offset(loops, 0).Value Then
If password = ActiveCell.Offset(loops, 1).Value Then
found = 1
End If
End If
loops = loops + 1
Wend
If found = 0 Then
Worksheets("Login").Select
Worksheets("Data").Visible = True
MsgBox ("Logon Failed")
Worksheets("Lowlev").Visible = False
Workbooks("Unit10assisgnment.xls").Close SaveChanges:=False
End If
Worksheets("Lowlev").Visible = True
Worksheets("Lowlev").Select
ActiveWindow.DisplayWorkbookTabs = True
End Sub
Comment