combo box doesnt filter record?

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
 
S

Steve Schapel

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top