use data selected from 3 combo boxes as query critiria in subform

F

Frances

I have a table T with data field1,2 and 3. In a form, I have 3 combo boxes
and 1 sub form. Select field1 from combo1. Combo2 will show those records
of field2 that matches field1. And Combo3 will show those records of field3
that matches field2. After field3 is selected, subform will show a query
result with field1, 2, and 3 as critiria. My problem is that the subform
only display records match field1 and field2. The field3 does not take
effect.

Private Sub Combo3_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[field3] = '" & Me![Combo3] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub

Row Source for combo3 is
SELECT DISTINCT [T].field3, [T].[field2] FROM [T] WHERE
((([T].[field2])=[Forms]![myform]![field2]));

Please point out where I made mistake. Do I really need 3 combo boxes or
there is a better way to select three data fields?

Thank in advance!
 

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