View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Populate Drop-Down Listbox from Query?

Do you know how to use Event Procedures? If not, search here and read up on
them.

The Query result table is a QueryTable object, which has an AfterRefresh
event. You can build an event procedure using AfterRefresh to populate the
combobox. The QueryTable.ResultRange gives you a way to access your
querytable (and so you can know the exact number of rows in it after the
refresh). Then the combo's .ListFillRange can be filled with whichever cells
you need.
--
- K Dales


"Oggie Ben Doggie" wrote:

I have a database I can access through ODBC. I'm familiar with how to
populate the spreadsheet from the database, but would like to find a
way to populate a drop-down list with information from a table in the
database, *without* dropping the list onto the spreadsheet (i.e., if
this were a validation box, we'd access the query info directly instead
of referencing a group of cells).

I imagine this can be done with some programming but its a weak point
of mine - can anyoen help?

O.Ben.D.