What I'm trying to do is a simple "realtime" search to the form.
The form has 3 editboxes: id, firstname, surname
Typing to those boxes fires up the "OnKeyUp"-event what should take the search keys from the editboxes and with adoquery.locate move the cursor to the matching row.
The trouble is that when using multiple keyfields, only the last keyfield uses loPartialKey option. That option should be used in every keyfield. So what to do?
I have now made this:
Code:
procedure TForm_users.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
var Edit_id_int, errorPos: Integer;
begin
Val(Edit1.Text, Edit_id_int, errorPos);
if errorPos = 0 then
begin
ADOQuery1.Locate('user_id;firstname;surname;',VarArrayOf([edit_id_int,Edit2.Text,Edit3.Text]),[loCaseInsensitive,loPartialKey]);
end
else
begin
ADOQuery1.Locate('firstname;surname;',VarArrayOf([Edit2.Text,Edit3.Text]),[loCaseInsensitive,loPartialKey]);
Edit1.Clear;
end
end;
Please, pretty please, help me!!
