combo box choices based on first combo box

E

Eric

I know this may be pretty basic and has been covered before, but I can't
remember how to get this to work.

Right now I have 2 combo boxes set up with 2 tables for each.
Combo box 1 has 3 choices, A, B, C.
For Combo box 2 I want the list of choices to be dependent on choice from
combo box 1. Say I choose 'A' from combo box 1, then I only want those
options related to A to be available choices for combo box 2 'List 1'. If I
choose 'B' then 'List 2'. etc.


Thanks for the input,
Eric
 
A

Al Campagna

Eric,
Use the value from cbo1 to filter the query behind cbo2.
For example, given a combo named cboLetter, with 3 possible values
(A,B,C)...
In the query (RowSource) behind cboTwo, use the following criteria
against the field Letter...
=Forms!frmYourForm!cboLetter
Also, use the AfterUpdate event of cboLetter to Requery cboTwo, so
whenever cboLetter changes, cboTwo's selections stays in synch.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
E

Eric

I'm not getting it to work quite right.

I should have metioned that I'm using Access 2000.
Does this make a difference?
Eric
 
A

Al Campagna

Eric,
I'm not getting it to work quite right.
Unfortunately that doesn't tell us anything.
Do you get an error?
Did you try Arvin's solution?

Please describe in detail what problem you're having, how you have cbo1
and cbo2 set up, and cut and paste any code you're using in your reply.
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
E

Eric

I tried to modify Arvins list box example to fit my combo box.
After selecting from cbo1 there is error message Field "Issues.Problems"
can't be zero length string


Private Sub Problem_Area_AfterUpdate()
Me.Problem_Area = "" (debug goes to this line)
Me.Problem_Area.Requery
Me.Requery

End Sub


Private Sub Combo93_AfterUpdate()
Me.Requery
End Sub
 
A

Al Campagna

Eric,
I think you'll have to work that out. That's probably not related to
Arvins code.
Check your table to see if you have the bound field for that control set
to AllowZeroLength to YES.

I asked for details about your combo boxes. (their names, columns,
column widths, bound to fields)

I do notice that you haven't incorporated Arvin's code correctly. The
Problem_Area After Update code is supposed to operate against your second
combo, not itself.
Otherwise... we need more details to go further...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 

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