Filter Subform with Text Box Control on Each Entry

What event/code should I use to produce the following functionality:
The user has a text box control and a subform. The subform is filtered based on one column for every entry the user makes in the text box. I.e. if the user enters "a" the subform is filtered by values which contain "a", then the user enters "ab" and the subform is further filtered, etc.
I'm sure someone has done this?
Thx,

MV
LVL 11
Michael VasilevskySolutions ArchitectAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
mbizupConnect With a Mentor Commented:
Make sure you are using the TEXT property.

I forgot to include the asterisk in my post:

Me.SubformControlName.Form.Filter = "YourField LIKE '" & Me.txtBox.Text & "*'"
0
 
mbizupCommented:
Use the on Change event of the textbox:


Me.SubformControlName.Form.Filter = "YourField LIKE '" & Me.txtBox.Text & "'"
0
 
Rey Obrero (Capricorn1)Commented:
use the change event of the text box

private sub text0_change()

sFilter="[columnName] like '*" & text0.text & "*'"

me.subformControlName.form.filter= sfilter
me.subformControlName.form.filteron=true

end sub
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
Michael VasilevskySolutions ArchitectAuthor Commented:
I tried OnChange, but find if I enter a blank textbox and start typing, the value of the text box remains null until I tab out of it.
E.g. enter textbox, value is null
type "a", value is null
type "b", value is null
tab out or shift+enter to update control, value is now "ab"

so I need to update the control on each change, but I don't see that.
Any ideas?
0
 
Michael VasilevskySolutions ArchitectAuthor Commented:
ah-ha that's it.
Thx!
MV
0
 
Rey Obrero (Capricorn1)Commented:
mvasilevsky,

upload a copy of the db
0
 
mbizupCommented:
The Change Event fires with every change that is made to the text in the textbox.

The Text property the text in the box as it is seen real-time.

as opposed to this:
Me.SubformControlName.Form.Filter = "YourField LIKE '" & Me.txtBox & "*'"

Which defaults to the value (or saved) data -- which only changes as you noticed when you tab out of or otherwise leave the field.
0
 
Rey Obrero (Capricorn1)Commented:
that is correct, BUT without this line

me.subformControlName.form.filteron=true

your first line is WORTHLESS
0
 
mbizupCommented:
<<your first line is WORTHLESS>>

Rey,

That was needlessly rude.  

If you have an issue with a closure, please use the Request Attention button instead of posting insulting comments.  Depending on the individual posting a question, a detail like that may be understood (or not).

My understanding here was that the actual Event and the Text property were the missing links.
0
 
Rey Obrero (Capricorn1)Commented:
whoa, i did not know that speaking of the obvious truth is an act of rudeness.
0
 
Michael VasilevskySolutions ArchitectAuthor Commented:
I agree that saying any part of anyone's post is "worthless" could be construed as rude.
Indeed, the piece I was stuck on was the .text property and I needed that explicitly stated apparently.

Capricorn1, I appreciate your input on this question and look forward to supporting both of you in your continued domination of the EE MS Access topic :-)

Let's get back to solving the world's problems!
0
 
mbizupCommented:
Sounds like a plan.

:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.