Hi,
Yet another thing I need help with I'm affraid. I'll first explain what I want, then I'll try to explain what I have. I'm using Microsoft Access 2000.
What I want is to be able to do a search, taking it's criteria fro a text box on a form. This bit is easy, done it a jazillion times. But I want it to be an "Or" search. If I type in it "Cakes, Cheese", I don't want it to bring up results that contain cakes AND cheese, I want it to bring up all results that contain either cakes OR cheese. Now, I can do this if I put what I want into the query. So if I put in the query:
then that works absolutley fine. However, if I link the query to a text box and in the text box I type in: " "Cake" Or "Cheese", that doesn't work.
Now then. What I have, is a database, it stores the learning resources we have, books, videos, etc. I have a search form. On it is a list box and a text box. The list box contains a list of subjects such as Careers, Health, Sex Education, etc. When you click on a word in the list box, it appears in the text box, seperated by a comma. I then have a query based on the contents of that text box where the words appear. Now, that works absolutley fine as an "And" query. If I only select one subject to search by, it will show all resources that relate to that subject. If I select more than one subject, it will show me all the resources that have both subjects. (i.e. if I select Health and Wellbeing, it will show be all the resources that are both health AND wellbeing.) But I want it to show all of the resources that have EITHER of the result words, not BOTH of them. Like I said, I can do this if I hotwire it into the query, but I can't do it if the query gets the search criteria from a text box.
This is what I have as the query:
and this works fine as an 'And' search. Now for the record, in that text box, the words don't have to be seperated by a comma. I can insert anything in between the words, for example, if health and wellbeing were clicked in the list box, I could make it appear in the text box as: " "Health" Or "Wellbeing" ". Done that and it still doesn't work.
If I put the query as:
that's okay. However, if I put the query to only get it's criteria from a text box, (i.e. make the query: [Forms]![SearchSubjects]![Subject]) then put the same expression into the text box that worked in the query, that won't work.
So to cut all this down now into a one sentence evaluation, does anybody out there know how to do an "Or" search which gets it's criteria from a text box? The layout of the words in the text box can be modified to automatically put in quotation marks, "OR"s or whatever else is needed between the search words.
I hope all of this is understandable, and I will really, truly be greateful for any help anybody can give.
Yet another thing I need help with I'm affraid. I'll first explain what I want, then I'll try to explain what I have. I'm using Microsoft Access 2000.
What I want is to be able to do a search, taking it's criteria fro a text box on a form. This bit is easy, done it a jazillion times. But I want it to be an "Or" search. If I type in it "Cakes, Cheese", I don't want it to bring up results that contain cakes AND cheese, I want it to bring up all results that contain either cakes OR cheese. Now, I can do this if I put what I want into the query. So if I put in the query:
Code:
Like "Cake" Or "Cheese"
Now then. What I have, is a database, it stores the learning resources we have, books, videos, etc. I have a search form. On it is a list box and a text box. The list box contains a list of subjects such as Careers, Health, Sex Education, etc. When you click on a word in the list box, it appears in the text box, seperated by a comma. I then have a query based on the contents of that text box where the words appear. Now, that works absolutley fine as an "And" query. If I only select one subject to search by, it will show all resources that relate to that subject. If I select more than one subject, it will show me all the resources that have both subjects. (i.e. if I select Health and Wellbeing, it will show be all the resources that are both health AND wellbeing.) But I want it to show all of the resources that have EITHER of the result words, not BOTH of them. Like I said, I can do this if I hotwire it into the query, but I can't do it if the query gets the search criteria from a text box.
This is what I have as the query:
Code:
Like "*" & [Forms]![SearchSubjects]![Subject] & "*"
If I put the query as:
Code:
Like "*" & "Wellbeing" & "*" Or "*" & "Health" & "*"
So to cut all this down now into a one sentence evaluation, does anybody out there know how to do an "Or" search which gets it's criteria from a text box? The layout of the words in the text box can be modified to automatically put in quotation marks, "OR"s or whatever else is needed between the search words.
I hope all of this is understandable, and I will really, truly be greateful for any help anybody can give.
Comment