Combo Box

  • Thread starter Thread starter Sazed
  • Start date Start date
S

Sazed

I've a form namely "Transection" and in that form there are two combo
boxes. One of them is listing all the Brand names (Motorola, LG, TCL
etc...) and the other one listing all the model numbers for those
brands. Both are getting information from different tables for brand
and model numbers independently. Now. in the form when I select
"Motorola" brand, the other combo box with the model numbers should
show only a list of selected brand's model numbers. How can I have this
done? Hope my poor english is enough for you to understand my query and
awaiting for your help urgently, please.
 
Sazed said:
I've a form namely "Transection" and in that form there are two combo
boxes. One of them is listing all the Brand names (Motorola, LG, TCL
etc...) and the other one listing all the model numbers for those
brands. Both are getting information from different tables for brand
and model numbers independently. Now. in the form when I select
"Motorola" brand, the other combo box with the model numbers should
show only a list of selected brand's model numbers. How can I have this
done?


Here's a short article that explains it.
http://www.mvps.org/access/forms/frm0028.htm
 
doesnt work! after inputing the suggested following code it askes for
"peremeter value"

Private Sub cbxCombo1_AfterUpdate()
Dim strSQL As String
strSQL = "Select " & Me!cbxCombo1
strSQL = strSQL & " from Categories"
Me!cbxCombo2.RowSourceType = "Table/Query"
Me!cbxCombo2.RowSource = strSQL
End Sub

what to do now?
 
Sazed said:
doesnt work! after inputing the suggested following code it askes for
"peremeter value"

Private Sub cbxCombo1_AfterUpdate()
Dim strSQL As String
strSQL = "Select " & Me!cbxCombo1
strSQL = strSQL & " from Categories"
Me!cbxCombo2.RowSourceType = "Table/Query"
Me!cbxCombo2.RowSource = strSQL
End Sub


You used the wrong part of the article. Then second part
explains that the model combo box's RowSource query should
use a criteria that refers to the brand combo box.

SELECT modelname
FROM models
WHERE brand = Forms!Transection.cboBrands

Don't forget the Requery code in both the brands combo box's
AfterUpdate event and in the form's Current event.

Be sure to replace the names I used with the ones you have
in your form and double check their spelling.
 
Back
Top