Hi Guys, the procedure is as follow:
procedure TLogowanie.MaskEdit1KeyPress(Sender: TObject; var Key: char);
var
iloscznakow: string;
iloscrekordow: longint;
imieinazwisko: string;
filtr: string;
begin
iloscznakow := inttostr(length(MaskEdit1.Text)+1);
if iloscznakow = '4' then
begin
Label3.Caption := '';
Dbf1.FilePathFull := './database';
Dbf1.TableName := 'users.dbf';
Dbf1.Exclusive := True;
Dbf1.Open;
Dbf1.Active := True;
// sprawdzam czy haslo jest komus przypisane
filtr := MaskEdit1.Text;
Dbf1.Filter := 'HASLO = ''' + filtr + '''';
Dbf1.Filtered := True;
Dbf1.Refresh;
iloscrekordow := Dbf1.RecordCount;
if iloscrekordow = 1 then
begin
Label3.Caption := inttostr(iloscrekordow);
end;
Label3.Caption := filtr;
Dbf1.Active := False;
Dbf1.Exclusive := False;
end;
end;
The problem is that:
1. I wrote 4 chars in MaskEdit, but variables are saying that there's only 3 chars in MaskEdit, why?
2. Why filtering is not working ... even if MaskEdit.Text is '123' instead of '1234' there should be 0 records but lazarus is saying that there are 3 records (whole database records is 3)