D
Dan Neely
I'm trying to use two comboboxes to filter date on a subform. Both
the parent and child forms have the same table as their data source.
The cb's on the parent are set to the two FKs I want to use to filter
the data on, and those FKs are used to link data between the forms.
To filter on a single parameter, with a single field linked I can use
the wizard generated code below.
Private Sub Combo11_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[FK1ID] = " & Str(Nz(Me![Combo11], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
With two fields linked though it always uses the first FK for the
second field, instead of ignoring it entirely.
My attempt to modify the code to filter on both CB values has been
unsuccessful. Adding the & to the second half of the expression got
it to compile without error, but it always returns the rows that have
1 for both keys regardless of the actual selections.
rs.FindFirst "[FK1ID] = " & Str(Nz(Me![Combo11], 0)) & "& [FK2ID]
= " & Str(Nz(Me![Combo6], 0))
the parent and child forms have the same table as their data source.
The cb's on the parent are set to the two FKs I want to use to filter
the data on, and those FKs are used to link data between the forms.
To filter on a single parameter, with a single field linked I can use
the wizard generated code below.
Private Sub Combo11_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[FK1ID] = " & Str(Nz(Me![Combo11], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
With two fields linked though it always uses the first FK for the
second field, instead of ignoring it entirely.
My attempt to modify the code to filter on both CB values has been
unsuccessful. Adding the & to the second half of the expression got
it to compile without error, but it always returns the rows that have
1 for both keys regardless of the actual selections.
rs.FindFirst "[FK1ID] = " & Str(Nz(Me![Combo11], 0)) & "& [FK2ID]
= " & Str(Nz(Me![Combo6], 0))