Problem with a DBlookupcombo box

On one of my forms I have 3 DBlookupcombo boxes which filter a table on their dropdown event, the problem is that only one of them actually work correctly. When I select a value in one of the others it highlights ALL the values in the dropdown menu at once so that the dropdown menu always selects the first value in the list no matter where I click.

here is the code behind the boxes, the first one is the one that works correctly:

[code]begin
Adobooks.Filtered:=False;
Adobooks.filter:='TitleofBook=' + QuotedStr(SGLoan.Cells[0,1]);
AdoBooks.Filtered:=True;
AdoItems.Filtered:=False;
AdoItems.filter:='OnLoan=' + 'False AND BookID=' + inttostr(AdoBooksBookID.value) ;
AdoItems.filtered:=True;
end;

procedure TLoanForm.DBLCBook2DropDown(Sender: TObject);
begin
Adobooks.Filtered:=False;
Adobooks.filter:='TitleofBook=' + QuotedStr(SGLoan.Cells[0,2]);
AdoBooks.Filtered:=True;
AdoItems2.Filtered:=False;
AdoItems2.filter:='OnLoan=' + 'False AND BookID=' + inttostr(AdoBooksBookID.value);
AdoItems2.filtered:=True;
end;

procedure TLoanForm.DBLCBook3DropDown(Sender: TObject);
begin
Adobooks.Filtered:=False;
Adobooks.filter:='TitleofBook=' + QuotedStr(SGLoan.Cells[0,3]);
AdoBooks.Filtered:=True;
AdoItems3.Filtered:=False;
AdoItems3.filter:='OnLoan=' + 'False AND BookID=' + inttostr(AdoBooksBookID.value);
AdoItems3.filtered:=True;
end;[/code]

I am using Delphi 7.

I have no idea what could be causing this so any suggestions on how to fix it would be appreciated.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories