Topic: Autocomplete

Hi

Is it possible to autocomplete other fields in a form

Example

I choose a customer from a combobox and i want the adress, postal, city autocomplete on other fields on the same form

Grftz

Re: Autocomplete

Hello.


procedure Form1_ComboBox1_OnChange (Sender: TObject);
var
    sDate: string;
begin
    Form1.edPFirstName.Text := SQLExecute('SELECT firstname FROM person WHERE id='+Form1.ComboBox1.sqlValue);
    Form1.edPLastName.Text := SQLExecute('SELECT lastname FROM person WHERE id='+Form1.ComboBox1.sqlValue);
    Form1.cbPGroup.dbItemID := SQLExecute('SELECT IFNULL(id_groups, -1) FROM person WHERE id='+Form1.ComboBox1.sqlValue);

    sDate := SQLExecute('SELECT dob FROM person WHERE id='+Form1.ComboBox1.sqlValue);
    if sDate<>'' then Form1.dtDOB.Date := SQLDateTimeToDateTime( sDate ) else Form1.dtDOB.Checked := False;
end;

Project example:

Post's attachments

Attachment icon Autocomplete form using ComboBox.zip 30.58 kb, 21 downloads since 2018-08-03 

Dmitry.

Re: Autocomplete

Nice

Exactly what i was looking for

Thnx