Filter a combox based on selection from another combox

D

David

I have two comboxes and I would like the user to select a value and based off
that value second combox is filtered with certain results. So, I created two
comboxes based of tables values. Here is how I set them up.

Combox 1
Field Name TOT
Placement Test
ESL Placement Test
ATB

Combox 2

Row 1 (TOT1) Row 2(TOT2)
English and Reading Placement Test
English Retest Placement Test
Reading Retest Placement Test
ESL Test ESL Placement Test
ESL Retest ESL Placement Test
ATB Test ATB
ATB Retest ATB

So, for example if the student selects Placement Test form Combox1 then the
list for combox2 would list "English and Reading", "English Retest", and
"Reading Retest"

I was trying some basic code but I had no luck
DoCmd.ApplyFilter , "ToT2 = 'me.combox1'"

Thank you all that take a look at this.
 
S

SteveD

David,
in the Row Source of the dependent (second) combobox include as part of the
query the first combobox. Then on the OnEnter event for the second combobox,
add me.combobox2.requery

This will provide the results in the second combo box based upon the results
of the first combobox.

SteveD
 
S

Stuart McCall

SteveD said:
David,
in the Row Source of the dependent (second) combobox include as part of
the
query the first combobox. Then on the OnEnter event for the second
combobox,
add me.combobox2.requery

This will provide the results in the second combo box based upon the
results
of the first combobox.

SteveD
<snip>

SteveD

The advice is good, but IMO the better event to execute this is the first
combo's AfterUpdate, so that the second combo is only requeried if the first
combo has changed.
 

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