Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Live Filter?...

Status
Not open for further replies.

Woodman650

Technical User
Jan 20, 2005
92
US
Hey all,
I'm trying to create a dvd database for personal use and I was wondering...

I've got my dvd titles listed in a Listbox and I've got a blank text field above it. I've seen databases where you can type something into this field and the results are filtered in real-time as you continue typing (in this case, the title of the movie). Anyone know how to do something like this? thanks for any help you can swing my way
 
You could try setting the Row Source for your list box to:
[tt]SELECT tblTable.DVDTitle FROM tblTable WHERE tblTable.DVDTitle ) Like [Forms]![frmForm]![txtText] & "*";[/tt]
Then add a little code to the form:
Code:
Private Sub txtText_Change()
Me.lstList.Requery
Me.Recalc
Me.txtText.SelStart = Len(Me.txtText.Text)
End Sub
 
that makes sense... but I can't get it to work. The title of the table should be "tblTable" and the form should be "frmForm", the text box should be called "txtText", and the column in the table to pull values should be "DVDTitle"... correct?

 
maybe I'm putting the VB somewhere wrong? I'm just opening the code window and pasting it in...
 
That sounds right as regards the sql, you may wish to use the ... beside Row Source to build the statement, so you can be sure the names are correct for your application. The snippet of code can be pasted into the code window, but you need to check that there is an event procedure for On Change for whatever you called the textbox. Access does not always change the property sheet when you paste code.
 
my only problem is that the values don't appear in the listbox. you can select em, but they don't appear. =/
 
I didn't quite catch that. Do you mean that that the listbox is not showing any values or that, if you type into the textbox, the listbox is not updating?
 
the former... not showing values... they are "selectable" but invisible
 
What was the row source for the listbox before all this?
 
SELECT tblTable.ID, tblTable.Title
FROM tblTable
ORDER BY tblTable.Title;

was the original... should I recreate it? enter my own values or something?
 
Yes, you should, except for adding the bit about:
Like [Forms]![frmForm]![txtText] & "*"
and changing frmForm to the name of your form and txtText to the name of the textbox that you want to search on.

The general idea is that the listbox picks up the text in the textbox as part of the sql. The code is to update the listbox on every change to the textbox. It should activate in the On Change event of the textbox.
 
i tried that... still no go.

I get what you're saying and have set it up, but I must be missing something really small. thanks a bunch for the help so far Remou... it's greatly appreciated
 
If the titles are selectable but invisible, perhaps you've inadvertently set the listbox control's fore color to the same as the back color?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top