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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Different combobox values depending on value chosen in other combobox?

Status
Not open for further replies.

schredder

Technical User
Feb 6, 2003
48
AE
Hi. Have a combobox (called "Produktekategorie") where one can chose between FM,IP,MTA,DD and Diverses. In the next combobox (called "testcbo") one can chose between E and F when FM is chosen in the combobox "Produktekategorie". But when IP is chosen in "Produktekategorie", then in the combobox "testcbo" one should chose between G and H. And so on with MTA,DD and Diverses. Thats the code in the afterupdate event of the combobox "Produktekategorie":

Function Produktekategorie_AfterUpdate()
Select Case Me.Produktekategorie
Case "FM"
testcbo.RowSource = "E;F"
Case "IP"
testcbo.RowSource = "G;H"
Case "MTA"
testcbo.RowSource = "I;J"
Case "DD"
testcbo.RowSource = "K;L"
Case "Diverses"
testcbo.RowSource = "M;N"
End Select
End Function

It doesnt work. In the combobox "testcbo" do i have to list E,F,G,... in the row source?
Any help is gr8ly appreciated.
Chris, Zurich (Switzerland)
 
Hi Chris,

This code should work, make sure that the combo box testcbo is set to "Value List" and not "Table\Query" or "Field List". Also before changing the values in testcbo in the afterupdate event you may want to set the rowsource for testcbo to "" so that the old selection if one is present doesn't remain in the combo box. Regards,
gkprogrammer
 
hi there...hmmm...somehow there is something wrong. in the combo testcbo do i have to list "E";"F";"G";... in the row source ? Even then it doesnt work. Is there another way to go? thanks again. chris
 
Hello Again Chris,

I quickly created a form with two comboboxes with the same names that you are using and copied and pasted the code into the AfterUpdate event of the "Produktekategorie" combobox and I received the expected result. Like I said all I had to do was to make sure in the property sheets for the testcbo it was set to a Value list and it updated correctly each time. What is the result that you are receiving when you attempt to make a selection in the comboboxes? Regards,
gkprogrammer
 
Damn, the testcbo combobox stays blank after chosing in the produktekategorie. Did so as u said, testcbo is on valuelist. In the combo testcbo do i have to list "E";"F";"G";... in the row source ? When i list "E","F",..."N" in rowsource of the testcbo then the testcbo combo lists exactly "E","F",..."N", it just doesnt limit the selction. Or should it be blank...
Is something like >requery< missing ?
Please help...wanna go skiing to Swiss alps this weekend...but not without resolving this problem !
thankss again
chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top