Filtering split form records from combo box (1 Viewer)

mcdhappy80

Registered User.
Local time
Today, 22:00
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
 

syntaktik

Registered User.
Local time
Tomorrow, 06:00
Joined
Oct 15, 2009
Messages
68
By any chance, How do i make it so that it disables the filter, Or displays all?
 
Last edited:

syntaktik

Registered User.
Local time
Tomorrow, 06:00
Joined
Oct 15, 2009
Messages
68
how would i put that in with the existing code? I tried an else if statement, but doesn't seem to work.
 

syntaktik

Registered User.
Local time
Tomorrow, 06:00
Joined
Oct 15, 2009
Messages
68
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?
 

syntaktik

Registered User.
Local time
Tomorrow, 06:00
Joined
Oct 15, 2009
Messages
68
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.
 

DBnub11

Registered User.
Local time
Today, 17:00
Joined
Jan 5, 2011
Messages
26
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:

blah

Registered User.
Local time
Today, 14:00
Joined
Jun 23, 2011
Messages
21
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...
 

orchbelt00

New member
Local time
Today, 17:00
Joined
Jul 21, 2009
Messages
7
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
 

ugadawgs306

New member
Local time
Today, 17:00
Joined
Feb 19, 2016
Messages
2
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.
 

fozziebox

New member
Local time
Today, 21:00
Joined
May 10, 2017
Messages
1
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

Top Bottom