how to get drop down list

  • Thread starter Thread starter GADGET
  • Start date Start date
G

GADGET

I have a small database that i use to produce a work sheet from. I wondered
how easy it would be to have a field for material and then to have a drop
down list of materials to save the inputting time.
Also on the same lines another drop down list when a model is selected it
fills in set information of other selected fields.

Regards

Martyn
 
hi,
see my reply post to Richard Horne in access general
questions
Post date = today Feb 21
time 1:39am
subject = Multiple combo boxes in a query
hi had a similar problem. i gave him a couple of web sites
with sample code and downloadable dbs.
good luck.
 
First, you have not mentioned anything about your database structure.
Assuming that the database is to handle projects I will assume you have a
Projects table something like this:
tblProjects
ProjectID (autonumber primary key)
ModelID (foreign key, with Data Type set to Number)
Material
etc.

You will probably need a Models table, which will look something like this:
tblModels
ModelID (autonumber primary key)
ModelDescription
ModelColor
etc.

Create a relationship between ModelID in the two tables. See Help for how
to do that. It is very important. Combine the two tables into a query, then
base a form on that query.
Back to the materials combo box (cboMaterial) , you could do something like
create a Materials table, which would contain just a primary key and a
listing of materials. Make a query based on the table (so that you can sort
the materials alphabetically), then use the combo box wizard to create a
combo box based on the query. Bind cboMaterial to Material from tblProject.
Similarly, create a combo box which has as its row source a query based on
tblModel. Bind it to ModelID in tblModelsOn your form, create an unbound
text box for ModelDescription (I will call the text box txtDescr) and another
for ModelColor (and so forth). In your combo box (cboModel) set the After
Update event to:

Me.txtDescr = Me.cboModel.Column(1)
Me.txtDescr = Me.cboModel.Column(2)
etc.

This means the second physical column in the query. The first column is
(0). Again, check Help for how to create an event, and post back if you have
more questions. The value of taking this approach is that you will only need
to store ModelID in tblProjects. By creating a relationship between ModelID
in the two tables you can see all of the model information each time you look
at a record in tblProjects, but you don't need to store each model detail in
every record. You store the date once, in tblModel, then link to it.

To use the combo box wizard, click the magic wand icon in the toolbox so
that it is highlighted, click the combo box icon in the toolbox, click on the
form, and follow the prompts. The second option (to type in the values)
should be limited to short lists that will not change (things like Yes, No,
Maybe), or (In State, Out of State).

This makes certain assumptions about your table. If you need specific help
 
Back
Top