做了个查询窗体, 
查询的条件比较多:州地市,单位,税务机关,税管员,税种,行业,行业明细 
这些条件都是用下拉组合框(combobox)来显示的。 
比如: 
我在州地市里选“四川省成都市”,后面的单位组合框就只能显示“成都市的单位”
如果"州地市"combobox中没有选择(为空),那么"单位"combobox中就应该显示的是数据库中的"全部单位" 
所以我就在form2.onshow事件中写了combobox提取数据库数据并显示的代码 
现在的问题是我在combobox的onchange中写了代码,不改变(选择了"州地市",而单位combobox中显示的仍然是全部的单位,没有将所选择的"州地市"的单位). 急!!!!!!!!
谢谢!!!!!!

解决方案 »

  1.   

    在combobox1的onchange事件中改变combobox2中的内容
      

  2.   

    你只能再用一个临时的,选择时将数据插入到临时的combobox中显示.
      

  3.   

    在combobox1的onchange事件中
    根据combobox1的选定值进行查询
    然后循环添加到combobox2中去就ok了
      

  4.   

    你在combobox的onchange中写的代码是什么?贴出来看看...
      

  5.   

    procedure TForm2.ComboBox3Change(Sender: TObject); //更改税管员
    var s3:string;
    begin
    if combobox3.Text='' then
    begin
    combobox4.Visible:=true;
    combobox8
    .Visible:=false;
    end
    else
    begin
    s3:=copy(combobox3.Text,1,pos('[',combobox3.Text)-1);
    combobox8.Items.Clear;
    combobox4.Visible:=false;
    combobox8.Visible:=true;
    LJClientDataSet8.Close;
    LJClientDataSet8.Provider.DataRequest('select distinct oper_num,oper_name from dsbm.oper_def '+
    'where oper_num in (select sgy from dsbm.shd where swjg='+s3+') and cxjc=5  order by oper_num / ');
    LJClientDataSet8.Open;
    combobox8.Items.Add('');
    while not LJClientDataSet8.Eof do
    begin
    combobox8.Items.Add(LJClientDataSet8.fieldbyname('oper_num').asstring+'['+LJClientDataSet8.fieldbyname('oper_name').asstring+']');
    LJClientDataSet8.Next;
    end;
    end;
    end;这是我按照上面二楼朋友的办法做的这个可以实现.
    不知道还有没有其他的办法可以实现.