Populating Combo Box Bases on Previous Combo Box Selection (1 Viewer)

abby_1309

Registered User.
Local time
Yesterday, 21:12
Joined
Mar 11, 2009
Messages
15
Hi ..I would appreciate if come one help me
I have Two Combo Boxes "Case Action","Case Action Comment".Therr are four possible Values for "Case Action" Combo i.e "Accepted","Screen-Outs",Rejection","Denial".I want to achive that when Ever user Select "Accepted" in "Case Action" Combo he will be given only a choice of three Values lets Say "Value1","Value2" and "Value3". Same way when He select "Screen-Outs" in "Case Action" Combo it will be given only a choice of three Values lets Say "Value4","Value5" and "Value6".If he Select "Rejection" in i"Case Action" Combo it will be given only a choice of three Values lets Say "Value7","Value8" and "Value9".
Same way for Denail.
Can some one help me with that plz
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 02:12
Joined
Sep 12, 2006
Messages
15,710
the normal way is to have the query that drives the second combo, include the value of the first combo in its criteria

then in the afterupdate for the first combo, you just have

secondcombo.requery
 

abby_1309

Registered User.
Local time
Yesterday, 21:12
Joined
Mar 11, 2009
Messages
15
Well..i dont wanan use query because there is no table with these values.so i would prefer a List given to rowsource
 

jibbajabba

Registered User.
Local time
Today, 02:12
Joined
Jun 19, 2009
Messages
17
Well..i dont wanan use query because there is no table with these values.so i would prefer a List given to rowsource

You still need to put code in the AfterUpdate event (As per Gemma's advice)

But for Value lists you'll need to do something like this:

Private Sub Combo1_AfterUpdate()

'combo1's rowsource = "boys;girls"

Select Case Me.Combo1.Value
Case "boys"
Combo2.RowSource = "Dave;John"
Case "girls"
Combo2.RowSource = "Ann;Susan"
End Select

Me.Combo2.Value = ""

End Sub

# the last line clears out the selected item in combo2, but you may want to test to see if the user has actually selected a different value in combo1 (this event fires if the user just enters combo1 and selects the same item that was there already)

# value lists are fine especially for immutable data, but if the list of items might one day change, you'll have to change the code, whereas if you use values from a table\query you just need to edit the underlying table
 

Users who are viewing this thread

Top Bottom