Variable drop-down list?

J

Jackmac

Hi all,

Hopefully an easy question for someone... I'm building a database to input
data which has an input form to make life easier. One of the things which
would help is a variable drop down list. For instance, there are two
drop-down boxes. One has say, car, house, boat, plane. The second
drop-down box will contain info relating to the first, so would have say,
wheels, steering wheel, front door, back door, hull, mast, wings, engines
(you get the idea...lol) Rather than list all the variables in the second
box I'd like it if say someone picked car from the first box, the only
choices in the second box would be wheels and steering wheel. There are
going to be a large list of choices in the second box and it would make it
easier if I could have it show only the related items... any ideas?

Any help, very much appreciated!

TIA

Jack
 
W

Wayne-I-M

Hi

You can set the source of the 2nd combo AfterUpdate of the 1st with a little
code.

The table must be link in the relationship windown first.

Something like this

Private Sub 1stCombo_AfterUpdate()
Me.2ndCombo.RowSource = "SELECT TableName.ID, TableName.Item,
TableName.LinkngField FROM TableName WHERE LinkngField = 1stCombo"

But if you are not used to this it may be simpler to just open the form in
design view then click the build option (for the second combo source) and
create a small querry (the wizard will do this for you). Ensure that you
include the linking field and in the criteria row of that column include the
1st combo of the form.

Good luck



Me.PayItem.SetFocus
Me.PayItem.Dropdown
End Sub
 
J

Jackmac

Jackmac said:
Hi all,

Hopefully an easy question for someone... I'm building a database to input
data which has an input form to make life easier. One of the things which
would help is a variable drop down list. For instance, there are two
drop-down boxes. One has say, car, house, boat, plane. The second
drop-down box will contain info relating to the first, so would have say,
wheels, steering wheel, front door, back door, hull, mast, wings, engines
(you get the idea...lol) Rather than list all the variables in the second
box I'd like it if say someone picked car from the first box, the only
choices in the second box would be wheels and steering wheel. There are
going to be a large list of choices in the second box and it would make it
easier if I could have it show only the related items... any ideas?

Any help, very much appreciated!

TIA

Jack

Hi Wayne/Pete. Thanks very much for the info. Very much appreciated!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top