Filter a drop down list

  • Thread starter Thread starter Jacques
  • Start date Start date
J

Jacques

I'm trying to get a drop down list to filter itself based on what was chosen
in the previous field (drop down list). I've seen another reference in this
thread that had a lot of code to make it happen. I'm wondering is there a
way to achieve this without having to write a bunch of code.

TableA 1-many TableB 1-many TableC

The first three fields of TableD are the PK's of A, B, and C.

I would like to have a form that has a drop down for A, then a filtered one
for B based upon what was chosen for A, and the same for C based on B.

What's the best way to do this?

Thanks beforehand.
 
You'll need to write code, but not "a lot of code".

1.) In the AfterUpdate event of comboA, build a SQL statement and set it as
the .RowSource property for comboB.

2.) Requery comboB.

Assuming the PK is the bound column in comboA...
- ComboB.Rowsource = "select x,y,z from abc where PK = " & comboA.value
- comboB.Requery

If PK is not the bound field . .. where "w" is the column number with the PK
- ComboB.Rowsource = "select x,y,z from abc where PK = " & comboA.column(w)
- comboB.Requery


Hope this helps.
 

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

Similar Threads


Back
Top