Hasan
To achieve your goal you need to requery the row source of the 2nd combo box
every time the 1st combo box is updated. In the AfterUpdate event of the 1st
combo box write code similar to this:
Private Sub cboCategory_AfterUpdate()
Dim stCriteria AS String, stSQL AS String
If Not Isnull(Me.cboCategory) Then
stCriteria = "WHERE Category_ID = " & Me.cboCategory
stSQL = "SELECT Product_ID, Product_Desc, Category_ID FROM Products " &
stCriteria
Me.cboProducts.RowSource = stSQL
Me.cboProducts.Requery
End If
End Sub
Please Note: In the above example I assume that
. the Category_ID field has a number field type otherwise stCriteria
should be "WHERE Category_ID = '" & Me.cboCategory & "'". Note the single
quotes!
. Category_ID is a foreign key in the table, Products, and a primary
key in the Categories table.
. Combo box 1 has a name cboCategory and combo box 2 cboProducts
HTH
Liveson
From: [email protected] [mailto:[email protected]] On Behalf
Of Hasan Raza
Sent: Wednesday, 14 April, 2010 11:29
To: [email protected]
Subject: [ms_access] 2 combo boxes and 1 subform
dear group members,
i have a problem. i have two combo boxes and one subform in which one is
populated/linked with product-categories, 2nd combo box row source is
products. and i want that when i select a category from 1st combo box then
related products will shown in 2nd combo box and when i select a product
from 2nd combo box then the related orders list will open in subform.
kindly help me. advance thank you.
Send instant messages to your online friends http://uk.messenger.yahoo.com
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]