Filter on a listox

V

Vsn

Hi all,

I was wondering; is it possible to apply a filter to a ListBox the same way
as is possible to a form recordsource?

Filter = "fID=1"
FilterOn=TRUE

Or are ther other methods so achieve the same?

Thx,
Ludovic
 
A

Al Campagna

Vsn,
Apply your filter to the Row Source table/query behind the
listbox.
On a form, your Row Source query might have a criteria like

fID Like "*" & Forms!frmYourForm!YourTextControl & "*"

If YourTextControl is null, all records are returned to the listbox...
or if it contains a value, only those related records are returned.
--
hth
Al Campagna
Microsoft Access MVP 2006-2009
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
V

Vsn

Thx, for this. I used this method before but because of the nessecity to do
a requery (and the screen blinking) on the form i hoped that a filter method
could be applied.

Ludovic
 
J

John W. Vinson

Hi all,

I was wondering; is it possible to apply a filter to a ListBox the same way
as is possible to a form recordsource?

Filter = "fID=1"
FilterOn=TRUE

Or are ther other methods so achieve the same?

Thx,
Ludovic

The usual way to get this effect is to construct a SQL string returning the
fields included in the listbox, with the desired criteria, and set the
listbox's Rowsource property to that SQL string. This implicitly does a
requery of the listbox.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top