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

Set values of Combo boxes from another combo

Status
Not open for further replies.

mett

Technical User
Nov 1, 2002
14
VN
I have 2 tables Category and Product on a form I want to select item Product after select Category. Please tell me How I do that.
Thanks.
 
Private Sub Category_AfterUpdate()
Dim strSQL As String
If Len(Trim("" & Category.Value)) > 0 Then
strSQL = "select [Products] from [Inventory Sub Category]"
strSQL = strSQL & " where Category = '" & Trim("" & Category.Value) & "'"
Me![Products].RowSource = strSQL
Me![Products].Requery
End If



End Sub Please remember to give helpful posts the stars they deserve!
This makes the post more visible to others in need!
 
Yah, except that you don't need to explicitly requery the combo box, as that will happen when you update the rowsource. I _think_ that requerying will make it happen twice. Not a huge deal, but some combobox rowsources are complex enough that it's probably best to avoid that.

Jeremy =============
Jeremy Wallace
Designing, Developing, and Deploying Access Databases Since 1995

Take a look at the Developer's section of the site for some helpful fundamentals.


Remember to reward helpful tips with the stars they deserve.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top