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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox and inserting data from Database 1

Status
Not open for further replies.

PaidtheUmpire

Programmer
Jan 4, 2004
105
AU
What i have in my project is a function which allows the user to select four people and then do a function on the selected four.

What i want to do is the following...

I want four Comboboxes which when clicked will allow the user to select the people from a list of people, in the dropdown section.

So a user would come to this screen and click the first combobox and select a person, whose name is the NAME field of an ADOQuery. The second combobox would become active showing all people who are in the Query except the person in the first combobox... etc. etc.

SO if the ADOQueries results were:
ADAM, BILL, CARL, DAVE & FRED.
The first combobox would have all five shown. In the first combobox the user selects BILL.
The second combobox should have the following:
ADAM, CARL, DAVE & FRED.
But no BILL, as he has been selected.

Any idea on:
a) How to insert all names into a ComboBox (Where the names are from a field in an ADOQuery [SELECT * FROM People WHERE Location = 'Australia';])
b) How to crop down the "items" from the first combobox, to remove the selected one.


Thanks to anyone who can help.
 
>a) How to insert all names into a ComboBox (Where the
>names are from a field in an ADOQuery [SELECT * FROM
>People WHERE Location = 'Australia';])
Code:
MyQuery.Open
ComboBox1.Items.Clear;
while not MyQuery.eof do
begin
  ComboBox1.Items.Add(MyQuery.FieldBYName('NAME').AsString);
  MyQuery.Next;
end;
ComboBox2.Items := Combobox1.Items;
...
>b) How to crop down the "items" from the first
>combobox, to remove the selected one.
Code:
i := ComboBox2.Delete(ComboBox1.ItemIndex);
...

-Dell


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top