Filtering split form records from combo box

mcdhappy80

Registered User.
Local time
Today, 02:55
Joined
Jun 22, 2009
Messages
347
I have a split form with a combobox.
How can I filter the records displayed in a form based on a combo box selection?
Can someone explain how to build this mechanism and write a sample code?

Thank You
 
By any chance, How do i make it so that it disables the filter, Or displays all?
 
Last edited:
how would i put that in with the existing code? I tried an else if statement, but doesn't seem to work.
 
but actually, i just put in a button to clear the filter, however, there is one other problem i am having. When i change the filter, it actually changes my field to that number. How do i prevent it from doing that?
 
thanks for wanting to help, but.. i somehow fixed it. Not sure what i did but it was not unbound, so that probably was the problem.
 
OK I am trying to use this technique and its not quite working right.

I have unbound the combo boxes on my split form and added the filtering code as lsited.

The problem is it is not showing the rest of the infor in the table. It comes back blank rather than with info. Thouhgi t is applying the filer properly

Any ideas?

I found the following as well
http://www.accessforums.net/access/split-form-select-records-based-criterea-4822.html

is this a better route if I plan to have multiple filters active?
 
Last edited:
Bob, you're amazing, and I want to thank you for all your contributions to the developer community.

Now then, how does one govern the behavior of the combobox on the datasheet side of the split? Does it not act weird? It seems to want to apply the selection to all the records, not just one...
 
Well, in the combo's after update event you put:

If numeric:
Code:
Me.Filter = "[WhateverFieldNameTheComboIsFiltering] = " & Me.ComboNameHere
Me.FilterOn = True

If Text:
Code:
Me.Filter = "[WhateverFieldNameTheComboIsFiltering] = " & Chr(34) & Me.ComboNameHere & Chr(34)
Me.FilterOn = True

If Date:

Code:
Me.Filter = "[WhateverFieldNameTheComboIsFiltering] = #" & Me.ComboNameHere & "#"
Me.FilterOn = True




This code is perfect. How would you ammend the text style so that I can use "contains" or "is like" instead of "equals"?

Thanks
 
Well, in the combo's after update event you put:

If numeric:
Code:
Me.Filter = "[WhateverFieldNameTheComboIsFiltering] = " & Me.ComboNameHere
Me.FilterOn = True

If Text:
Code:
Me.Filter = "[WhateverFieldNameTheComboIsFiltering] = " & Chr(34) & Me.ComboNameHere & Chr(34)
Me.FilterOn = True

If Date:

Code:
Me.Filter = "[WhateverFieldNameTheComboIsFiltering] = #" & Me.ComboNameHere & "#"
Me.FilterOn = True

How would this be modified to allow for multiple filters? For example, I have a split form with two dropdown boxes (cboTeam and cboAuditor). I would like the datasheet of the splitform to filter based on the selection of both drobdown boxes. Currently, they are working against one another versus in tandem with one another.
 
Well, in the combo's after update event you put:

If numeric:
Code:
Me.Filter = "[WhateverFieldNameTheComboIsFiltering] = " & Me.ComboNameHere
Me.FilterOn = True

If Text:
Code:
Me.Filter = "[WhateverFieldNameTheComboIsFiltering] = " & Chr(34) & Me.ComboNameHere & Chr(34)
Me.FilterOn = True

If Date:

Code:
Me.Filter = "[WhateverFieldNameTheComboIsFiltering] = #" & Me.ComboNameHere & "#"
Me.FilterOn = True

I have this working but i have 3 combo boxes, is there a way to use this code and add the value of the other 2 boxes (or null) to the filter?

Cheers,
steven
 

Users who are viewing this thread

Back
Top Bottom