Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box lists 1

Status
Not open for further replies.

ds2728

Programmer
Jul 18, 2001
50
US
I have several combe boxes on a form, all unbound with lookup coming from another table containing just the options for that input.

these combo boxes go in order 1, then 2, then 3.

I would llike to limit the chooses in comdo box 2 to only the ones available for the selection option in combo box 1.

I have set up another table that has two fields, to list all possible options for combox box one selection. I thought I could qry this table, but I can not use the value from combo box 1 to use in the qry for combo box 2.

I would like to be automatic so when I move to the second combo box the chooses are already limited by combo box 1.

Any help is appreciated, thanks

dave
 
Ah yes we have answered it before. Cascading combo boxes

You are most of the way there already if all three of them work now
Its just a matter of tweaking the Row Source a bit
Open the second combo box in design view
then click its row source then click the 3 dots on the right to open the Query for it

Now then in the criteria of the field that looks at combo box 1 for its results add this code

Forms![yourformname].form.combo1

Now this only works for the Bound column
OK
DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
DougP,

Thanks,

I tried your suggestion and receive a blank in the pull down of the combo box.

combo box 1 values = 222, 223, 224
table used for combo box 2
field1= series = 222, 223
field2= bore = 09, 10, 11, 12
bound column = 1

form name= master_opertions_screen
combo box 2 name = bore

when I use your suggestion in the criteria for field1 it automatically places brackets around everything:

[Forms]![master_operations_screen].[form].[bore]

any further suggestions.....
 
Never Mind;

operator error, was using combo box 2 instead of combo box 1 in criteria.

thanks, works great.....
 
For anyone that cares, The solution given by DougP does work great,

Although I found that if you clear the values in the combo boxes to redo from the begining without reloading the form, the row source in the second combo box does not get reset to the new value. I solved this by event procedure combo1_exit and the following:
Me!combobox2.RowSource = "sqlstr"
I issue this command everytime I exit the first combo box and this seems to reset the qry string with the new values.

Thanks Again DougP


 
Hi, Just another option,

The method used is exactly the same as mine except I use requery on each cascading combobox on the onChange event.

so for the first combo you would have the single line of code.

combo1.requery

Ian Oldreive
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top