I'm creating a database in excel, as such I have the users' data and their passwords inserted in the tables (picture), I would like to know if the way I'm checking the credentials is correct because I'm not able to log in with the data I enter even though they correspond to the ones in the table. Can someone help me?
I enter the Username as "calmeiro_andre" and the password "1234" as in the table but I can't login
I enter the Username as "calmeiro_andre" and the password "1234" as in the table but I can't login
VBA Code:
Private Sub bt_seguinte_Click()
Dim usuario_verify, senha_verify, c As Long
usuario_verify = tb_usuario.Value
senha_verify = tb_senha.Value
lb_erro_usuario.Visible = False
lb_erro_senha.Visible = False
Select Case True
Case Trim(usuario_verify) = "" And Trim(senha_verify) = ""
lb_erro_usuario.Visible = True
lb_erro_senha.Visible = True
Case Trim(usuario_verify) = ""
lb_erro_usuario.Visible = True
Case Trim(senha_verify) = ""
lb_erro_senha.Visible = True
Case Else
Application.ScreenUpdating = False
contar_usuarios = Cells(Rows.Count, "D").End(xlUp).Row
For c = 2 To contar_usuarios
Sheets("Usuários").Cells(c, 4).Select
If ActiveCell = usuario_verify Then
If ActiveCell.Offset(0, 1) <> senha_verify Then
lb_erro_senha.Visible = True
lb_erro_senha.Caption = "*Senha ou Nome de Usuário incorretos"
MsgBox "1"
Else
Registar.Show
End If
ElseIf c = contar_usuarios And ActiveCell <> usuario_verify Then
lb_erro_senha.Visible = True
lb_erro_senha.Caption = "*Senha ou Nome de Usuário incorretos"
ElseIf ActiveCell <> usuario_verify Then
End If
Next c
End Select
Application.ScreenUpdating = True
End Sub