View Full Version : Multiple Query Criteria for same text box problem.


Bennett
04-22-2009, 03:17 PM
hi,

I am fairly new at this by the way. Basically i am creating a DVD database and one of the forms will be able to search the dvd table for certian films based on the criteria that is entered.

so far i have a form with 2 text boxes and a list box. the first text box (Text3) searches the field "film name" for matches on film titles and shows them in the list box. the criteria i have written for this is:
Like "*" & [Forms]![Alex Mess 3]![Text3] & "*"

this works fine and returns the films i want perfectly. However when i added the second text box (Text12) to be used to search for the actors names in the films things started to go wrong. i have 3 feilds in my table called actor 1, actor 2 and actor 3 (so it shows the 3 main actors in each film). what i did for each feild in the query is put this statement in each criteria for the feilds:
Like "*" & [Forms]![Alex Mess 3]![Text12] & "*"

However this doesnt gell well with the other text box. i know have it so Text3 works fine but when i type in Text12 to narrow the search down by actor it returns nothing.

i hope i have explained this well enough, please help. thanks

Uncle Gizmo
04-22-2009, 03:31 PM
>>> i have 3 feilds in my table called actor 1, actor 2 and actor 3 <<<

This is not a good idea, you need to put all your actors in one table, meaning you need a table with an ID for the film, and then against that ID the name of the actor. Something like this:

FilmID..............Actor
53.................fred Bloggs
53.................Mary Whithouse
53.................Silvester
53.................Moore

With this design you can have as many actors as you like, and if you want you can add a separate column to identify them as "leading actor" things like that. The other advantage is that you can now very easily search the data, with the system you have having a separate column, then you are going to run into real problems trying to extract data. For more information read this series of threads here: (http://www.access-programmers.co.uk/forums/showthread.php?p=671226)

Bennett
04-22-2009, 03:34 PM
ok thanks ill try that. i will let u know how it pans out.

thanks for your suggestion