Utiliza este código. Inicializaré la variable ClaveCorrecta para ver si es eso lo que te está dando problemas
Código Delphi
[-]
var
apellido, contrasena: String; ClaveCorrecta: Boolean; Intentos: Integer; begin
apellido := Edit1.Text;
contrasena := Edit2.Text;
ClaveCorrecta := False;
edit1.Clear;
edit2.Clear;
table1.First;
edit1.SetFocus;
while table1.eof = false do
begin
if (Table1.FieldByName('Apellido').AsString = apellido) and
(Table1.FieldByName('Clave').AsString = contrasena) then
begin
ClaveCorrecta := True;
Form1.Hide;
Form2.Show;
end;
table1.Next;
end;
if not ClaveCorrecta then
begin
ShowMessage('Clave Incorrecta');
Inc(Intentos);
if Intentos >= 4 then
begin
ShowMessage('Adios!');
Application.Terminate; end;
end;
end;
Saludos,
Chris