combo box doesnt filter record?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Many thanks to those who helped me out with my problems before.
I now have two dependent combo boxes working together. But neither of combo boxes filter the records in a form. Any comments appreciated. Cheers
(NB. both combo boxes and the form are based on different tables in Access2002)
-------------------------------------------------------------------------------
cboCategory
RowSourceType: Table/Query
RowSource: SELECT DISTINCTROW [CategoryID], [Category] FROM tblCategory ORDER BY [Category];
ColumnWidth: 0",1"
BoundColumn: 1
AfterUpdate: [Event Procedure]

Private Sub cboCategory_AfterUpdate()
Me.cboType.RowSource = "SELECT Type FROM" & _
" tblType WHERE CategoryID = " & Me.cboCategory & _
" ORDER BY Type"
Me.cboType = Me.cboType.ItemData(0)
End Sub
 
Sam,

I think I understand what you are trying to do. It seems to me that in
your query qryAllProducts, you should refer to the cboType combobox in
the criteria of the Type field, using syntax such as
[Forms]![NameOfForm]![cboType]

I will also comment that your code seems unnecessarily complicated. I
would normally set the RowSource property of the cboType combobox in the
properties of the combobox itself, and then the cboCategory_AfterUpdate
procedure just needs...
Me.cboType.Requery
 
Back
Top