combo box doesn't filter record in a form

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
 
C

Casey

Create a query that references the combo boxes in the
criteria of the fields that you are interested in.
Include all fields that you are interested in having show,
and make the query the source for your form, or use the
query in the apply filter action to apply to the form.

You would reference the a combo box in a similar way
to this, but use the real form name and combo box name.

forms.formname.combobox1

Casey
-----Original Message-----
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
---------------------------------------------------------- ---------------------
cboType
BoundColumn: 1
---------------------------------------------------------- ---------------------
frmShop
RecordSource: qryAllProducts (contains all fields in tblCategory and tblType)
Filter: (Blank)
.
 

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