Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Old 10-02-2009, 01:16 PM   #1
mcdhappy80
Newly Registered User
 
Join Date: Jun 2009
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
mcdhappy80 is on a distinguished road
Question Filtering split form records from combo box

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

mcdhappy80 is offline   Reply With Quote
Old 10-02-2009, 03:29 PM   #2
mcdhappy80
Newly Registered User
 
Join Date: Jun 2009
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
mcdhappy80 is on a distinguished road
Thumbs up Re: Filtering split form records from combo box

It works, thanks Bob
mcdhappy80 is offline   Reply With Quote
Old 10-15-2009, 12:50 AM   #3
syntaktik
Newly Registered User
 
Join Date: Oct 2009
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
syntaktik is on a distinguished road
Re: Filtering split form records from combo box

By any chance, How do i make it so that it disables the filter, Or displays all?


Last edited by syntaktik; 10-15-2009 at 12:57 AM.
syntaktik is offline   Reply With Quote
Old 10-15-2009, 11:01 PM   #4
syntaktik
Newly Registered User
 
Join Date: Oct 2009
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
syntaktik is on a distinguished road
Re: Filtering split form records from combo box

how would i put that in with the existing code? I tried an else if statement, but doesn't seem to work.
syntaktik is offline   Reply With Quote
Old 10-16-2009, 04:46 PM   #5
syntaktik
Newly Registered User
 
Join Date: Oct 2009
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
syntaktik is on a distinguished road
Re: Filtering split form records from combo box

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 is offline   Reply With Quote
Old 10-19-2009, 10:38 PM   #6
syntaktik
Newly Registered User
 
Join Date: Oct 2009
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
syntaktik is on a distinguished road
Re: Filtering split form records from combo box

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.
syntaktik is offline   Reply With Quote
Old 01-31-2011, 11:53 AM   #7
DBnub11
Newly Registered User
 
Join Date: Jan 2011
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
DBnub11 is on a distinguished road
Re: Filtering split form records from combo box

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/s...erea-4822.html

is this a better route if I plan to have multiple filters active?


Last edited by DBnub11; 01-31-2011 at 12:02 PM.
DBnub11 is offline   Reply With Quote
Old 11-15-2011, 12:37 PM   #8
blah
Newly Registered User
 
Join Date: Jun 2011
Posts: 20
Thanks: 8
Thanked 0 Times in 0 Posts
blah is on a distinguished road
Re: Filtering split form records from combo box

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...
blah is offline   Reply With Quote
Old 03-06-2014, 06:29 AM   #9
orchbelt00
Newly Registered User
 
Join Date: Jul 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
orchbelt00 is on a distinguished road
Re: Filtering split form records from combo box

Quote:
Originally Posted by boblarson View Post
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
orchbelt00 is offline   Reply With Quote
Old 02-19-2016, 05:59 AM   #10
ugadawgs306
Newly Registered User
 
Join Date: Feb 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ugadawgs306 is on a distinguished road
Re: Filtering split form records from combo box

Quote:
Originally Posted by boblarson View Post
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.
ugadawgs306 is offline   Reply With Quote
Old 05-10-2017, 06:33 AM   #11
fozziebox
Newly Registered User
 
Join Date: May 2017
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
fozziebox is on a distinguished road
Re: Filtering split form records from combo box

Quote:
Originally Posted by boblarson View Post
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

fozziebox is offline   Reply With Quote
Reply

Tags
box , combo , filter , form

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating my Combo Box fantimm Forms 12 07-09-2009 03:24 AM
Combo Box Populates All Form Records giladbr Queries 1 11-28-2006 12:18 AM
Show filtered form records in a combo box Keith Nichols Forms 8 10-23-2006 03:55 PM
combo box query on form Mike Hughes Forms 1 03-23-2003 04:24 PM
[SOLVED] Form and Subform/combo Box not pulling up all the records i want gxis Forms 2 06-02-2001 01:47 PM




All times are GMT -8. The time now is 06:01 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World