Drop-Down

K

Karen

I created a table with a list of names. I want to use
this table in my form and create a drop-down using this
table as a source. How can I do this?

Thank you
 
G

Graham R Seach

Karen,

Enter the following pseudo statement into the listbox's RowSource property:
SELECT fieldname FROM mytable

Obviously, change fieldname to the name of the table field you're using, and
change mytable to the name of the table you're using.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
J

Jason Rice

Since you have your name list already, all you have to do is open the form
that you want to use with the drop down list in design view. Then add the
control (combo box) and set the "Row Source" to either the table name or to
a query. It will be easier to control the names that appear in the list and
how they appear (i.e. alphabetically) with a query.

If you want to use a query you might use something like:

SELECT yournamefield FROM yournametable WHERE whereclause ORDERBY
yournamefield;

If you want to sort by something other than name (maybe by a start date)
then you need to add that field name (Select yourfieldname,
addthenewfieldhere FROM...). Then just use that field name in the ORDERBY
clause. The WHERE clause can be used to restrict the name list (i.e.
everyone that started more than 5 years ago, or everyone that is named
"John").
 
Top