How to use a wildcard in Yes-No queries? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to use a wildcard in Yes-No queries?

First of all, I know there is no wildcard for yes/no in access field types, I am looking for a way to obtain a result as if I used a wildcard. Let me explain: In my bachelor thesis I am doing a bibliographical research where I need to read A LOT of papers. Every time I read a paper I write down some things about it, like Authors, Title, Reference, Keywords.... I decided to build a very basic database that offers the following funcionalities: - Storage of all the papers with their respective information - A form that I can fill to introduce new papers to the database - And a form that allows me to search between the stored papers I decided to come up with the full list of Keywords before-hand and assign each one of them a Yes/No field that I can check or uncheck when filling the form. The problem came when I tried to build the query to search. I want the results of the search to show me the papers that include the keywords checked in the search form, but I don't want it to exclude the papers that include unchecked keywords. It's easier to understand with an example: If I have this table TABLE 1 ART1 [Theoretical YES] [Experimental NO] ART2 [Theoretical YES] [Experimental YES] and I check the Theoretical keyword and the Experimental keyword, I want the results to be ART2. If I check the Theoretical keyword and not the Experimental keyword, I want the results to be ART1 and ART2. I thought that using a statement like IFF([Field];Yes;"wildcard") would be enough, but as I said, the Yes/No wildcard does not exist. I know access is not a topic on this website but if anyone could help or knows where I can find help it would be nice!

2nd Mar 2020, 8:07 PM
Eloi Sanchez
Eloi Sanchez - avatar
1 Answer
+ 1
It might be easier for you to manually construct the SQL queries than to rely on the awkward MSAccess GUI. Look for the View selection and select SQL. There you can freely enter, edit and save your queries in text form. The two examples you requested would look like this: SELECT * FROM TABLE1 WHERE [Theoretical] = 'Y' AND [Experimental] = 'N'; SELECT * FROM TABLE1 WHERE [Theoretical] = 'Y'; In the second query here, by omitting any restrictions on the [Experimental] field, it is effectively a wildcard on that field.
12th Mar 2020, 12:12 PM
Brian
Brian - avatar