Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing A Distinct Number 1

Status
Not open for further replies.

patlim88

Programmer
May 14, 2002
22
US
I have a combo box that displays everything in field 'BACKGROUPNUMBER'. For example if there is 100 groupnumbers of 20020620052401 and 100 groupnumbers of 20010511231408 when I click on the combo box I see all two hundred numbers. The folowing code illustrates this:

procedure TForcedCall.FormCreate(Sender: TObject);
begin

// code below will list all the Group numbers in the drop down box

CallBackQ.Close;
CallBackQ.Prepare;
CallBackQ.Open;

CallBackCB.items.clear;
CallBackQ.Open;

while not CallbackQ.eof do

begin

CallBackCB.Items.Add(CallbackQ.Fieldbyname('BACKGROUPNUMBER').asstring);
CallBackQ.next;

end;

Is there a way to only show the two group numbers 20020620052401 and 20010511231408 in the combo box?

Thanks.
 
Add "DISTINCT" to your select SQL statement. F.ex. :
SELECT DISTINCT BACKGROUPNUMBER FROM MYTABLE

--- markus

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top