Display Everything from Combo Box

Fozi

Registered User.
Local time
Today, 16:21
Joined
Feb 28, 2006
Messages
137
I have a combo box which linked to a subform which display records based on the value selected in the Combo box. Straight forward enough. However I have added a selection for ALL. When the user selects this value I want the return to display all records.

The code is bound to the AfterUpdate property. and currently looks like this:

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

Set rs = Me.Recordset.Clone
If Me![Combo23] = " ALL" Then


rs.FindFirst "[Fullname] = '" & Me![Combo23] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub


Any tips?
 
I'm also looking for a solution for this issue.

i can successfully Filter the subform using the value in the combo box, but the subform always filters with the initial combo box value; even if it loads as null.

I dont understand why it is already filtered as the code is triggered on the AfterUpdate instance.

-------------------------------------------------------------
Private Sub Combo0_AfterUpdate()

' Find the record that matches the control.
Dim rs As Object

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

End Sub
-------------------------------------------------------------

Anyone have an idea of how i would show all records before they are filtered?

Thanks, Jamie
 
anyone have any idea before i call it a day and release this?

cheers, Jamie
 
All I can do is tell what how I handled it.

I used an unbound combo box on the main form and loaded the values what whatever I need.

Then I use an 'If Then', for example:

Code:
If cbo_Cust.Value = 'All'
     ctl_MainForm.Form.FilterOn = False
Else
     sfrm_SubForm_Name.Form.Filter = "[Cust] = '" + cbo_Cust.Value + "'"
     sfrm_SubForm_Name.Form.FilterOn = True
End If

sfrm_SubForm_Name is the name of the control in the main form of the sub form, NOT the actual Sub Forms name. Which btw is usually the same but not always.

This way if the user select 'All' it turns the filter off. If it is anything else I set the fitler to the value and turn the filter on.

Hope this helps,
 

Users who are viewing this thread

Back
Top Bottom