Filter list box using unbound text fields

  • Thread starter Thread starter jody
  • Start date Start date
J

jody

I have developed a database to collect call report
information. However, we want to be able to search using
a variety of different search fields so I've created
a "Search Form" that contains the following unbound text
fields: Customer, Location, CallDate, CallItem, ItemOwner.
When entering any data in any of the unbound fields, I
would like the query results to show up in a listbox
located in the bottom portion of the form. The multi
column listbox contains the following columns: Customer,
Location, Call Date, Sales Rep, Item Owner, Request Date,
Completed Date. I have a select query called
itemselectqry that contains all the necessary fields.

I'm not sure how to get all the pieces and parts to work
together (I'm fairly new to VB) How do I get the query
results to show up in my listbox rather than in a
datasheet view?

Any suggestions?
 
In this forum look under
re: Repost: Filtering Subform from a Form

I had the same situation. This solved my problem
 
If you are into filters, you may be able to use your query itself, however
I'm not even sure if you can use (or use with ease) multiple variable
filters (some of the experts in the newsgroup would know about this).
Otherwise you may want to revert to an actual SQL statement (a string)
which you can vary according to what is placed in the text boxes. For
example

"SELECT customer, product from yourTable where ID = " & txtID.value " and
color = ' " & txtColour.value & "'"

You can vary the string according to which text boxes are engaged (i.e..
not null or "").

Set your listbox rowsource property to the SQL string, and if need be, do a
refresh or requery on the listbox control.

You can start by copying your query in the "SQL View" of the query design
mode.

Hope this helps

John S
Aylmer, PQ
 
Back
Top