Unique Values in DB Combo
Posted on 1997-09-14
I have a DB form with a drop down DBField called 'City' . When a user is adding/editing a record, they can select values from the City drop down box on the form. This drop down list should only contain unique values from data already in the table. How do I...
1 When the form is created, I want to search/query the table for unique instances of Cities in the City field. For example, if the table contains 1,000 records and 500 have 'Atlanta' in the City field and the other 500 have 'Chicago', I only want Atlanta and Chicago to appear as values in the form's City drop down box ONCE. This is sort of like A lookup DBField but that would display Chicago and Atlanta 500 times each.
2 Once I find the unique values, I want to add them to the City DB Dropdown box. I know once I get the list of values I want to be in the list, I should use the ADD method to the TStrings of the combobox, but how do I get the query/search (or whatever) results into the strings?