Search Query Problem

Orangatuan

Ook!
Local time
Today, 05:53
Joined
Apr 19, 2005
Messages
7
I am creating a catalogue for 300+ books lying around my house.

On a form there are 2 text boxes called Search_Author and Search_Book and a combo box called Search_Genre

When The Fields are all empty the query brings back the entire database but whenever any field is not blank the query brings back nothing

the criteia for the query is
Like "*" & [Forms]![Search Form]![Search_Book] & "*"
Like "*" & [Forms]![Search Form]![Search_Author] & "*"
Like "*" & [Forms]![Search Form]![Search_Genre] & "*"
under their respective headings
i dont know what is wrong
 
Right way?

Wouldn't it be easier if you used a ordinary query with the textboxes as conditions in the query?
 
what do you mean like [Forms]![Search Form]![Search_Book] in the critiea??
 
create a query with all the fields from the table with the books.

then for title you have a condition where it must be the same as your textbox where you fill in the title.
the same for the rest...

i have an example but it doesn't seem to work to attach it.
do you have another way to get it?

Try search for the title My book or the author Tom Tom or Sci-Fi
 
example

Here is an example for how I would have solve the problem
 

Attachments

Huh?

doesnt work on my computer, do you need any add-ins for it to work??
 
I would use the excellent "Quicksearch" method in the sample databases. It'll search on all 3 fields at the same time using just one textbox and display a result in a listbox. The listbox list will refresh itself after each search letter thats typed in.

Then you select your item and do whatever with it.

Col
 
Thanks

It looks like it will do but i dont understand the VBA part of it have no idea how to convert it to my database
 
you will need to amend the underlying ListBox query to suit your table/query and amend the field names to your field names.

Just import the form and tables into your database and work through it step by step and keep testing it.

Col
 
It says missing syntax from
"Table_Books.Book Title"
do i need to rename the "Book Title" Field
Book_Title??
 

Users who are viewing this thread

Back
Top Bottom