Combobox中选择一项,从表中得出计数值,然后更改COMBOBOX1值时,应重新提出计数值,然我得到的仍是第一次得到的计数值,代码如下:
Procedure Tform4.Combobox1Exit(Sender:TObject);
var
  str1:string;
  count1:integer;
begin
  if combobox1.text:='aa' then
    edit1.text:='S-';
    str1:='Hleibie=1';
  if combobox1.text:='bb' then
    edit1.text:='G-';
    str1:='Hleibie=2';
  if combobox1.text:='cc' then
    edit1.text:='Y-';
    str1:='Hleibie=3';
  with datamodule1.adotable1 do
    begin
      filtered:=false;
      filter:=str1;
      filtered:=true;
      count1:=fieldvalues[Hjishu];
    end;
  edit2.text:=inttostr(count1);

解决方案 »

  1.   

    if combobox1.text:='aa' then
      begin
        edit1.text:='S-';
        str1:='Hleibie=1';
      end;其它也都要這樣處理!!!
      

  2.   


        edit1.text:='S-';
        str1:='Hleibie=1';
    改成:
      begin
        edit1.text:='S-';
        str1:='Hleibie=1';
      end;
    其它的一样
      

  3.   

    if combobox1.text='aa' then
      begin
        edit1.text:='S-';
        str1:='Hleibie=1';
      end;
      if combobox1.text='bb' then
      begin
        edit1.text:='G-';
        str1:='Hleibie=2';
      end;
      if combobox1.text='cc' then
      begin
        edit1.text:='Y-';
        str1:='Hleibie=3';
      end;
     with datamodule1.adotable1 do
        begin
          filtered:=false;
          filter:=str1;
          filtered:=true;
          count1:=fieldvalues[Hjishu];
        end;
      edit2.text:=inttostr(count1);