How to connect two DBLookUpComboboxes that can be used as filter in Lazarus
<p>I have 2 tables: 1. <strong>Projects</strong>, 2. <strong>Article_Weights</strong>.
Table <strong>Projects</strong> is connected to first DBLookUpCombobox <em>DBLkpCbo_Projects</em>.
It has one column <strong><em>Project</em></strong> which contains four digit numbers. (1001, 1004, 1008,...)</p>

<p>Table <strong>Article_Weights</strong> containing columns <strong><em>Project</em></strong>, <strong><em>Article_Number</em></strong>, <strong><em>Article_Weights</em></strong> etc. This table is connected with DBLookUpCombobox <em>DBLkpCbo_Articles</em>.</p>

<p>What I want to achieve is when I choose from first combobox some project, second combobox will show just article numbers which belongs to that projects. After that when I choose some article number from second combobox, information about this article will be shown in DBGrid.</p>

<p>Filtering is working. I am stuck on last point. When I choose some article number I get error "Data types do not match in the expression criteria"</p>

<p>This is my code:</p>

<pre><code>procedure TMainForm.DBLkpCbo_ProjectSelect(Sender: TObject);
begin
  if DBLkpCbo_Project.ItemIndex &lt;&gt; -1 then begin
    SQLQuery2.Active:=true;
    //SQLQuery1.ApplyUpdates();
    SQLTransaction1.Commit();
    SQLQuery2.Close;
    SQLQuery2.SQL.Text:='SELECT Article_Number FROM Article_Weights WHERE Project = '+DBLkpCbo_Project.Text+'';
    SQLQuery2.Open;
   end;
end;


procedure TMainForm.DBLkpCbo_ArticleChange(Sender: TObject);
begin
  if DBLkpCbo_Article.ItemIndex &lt;&gt; -1 then begin
    //DBGrid1.Enabled:=true;
    SQLQuery3.Active:=true;
    //SQLQuery1.ApplyUpdates();
    SQLTransaction1.Commit();
    SQLQuery3.Close;
    SQLQuery3.SQL.Text:='SELECT Article_Number FROM Article_Weights WHERE Article_Number='+DBLkpCbo_Article.Text+'';
    SQLQuery3.Open;
  end;
end;
</code></pre>

<p>Thank you for any answer</p>