Attaching Or condition in a query to a form

ipr

New member
Local time
Today, 02:47
Joined
Nov 20, 2012
Messages
7
I asked this in Queries before, but I think my problem is of a different nature now.

My database is meant for faculty members at my university to scout out potential research partners with similar interests.
I have a table with faculty members' names, and then a list of about 54 keywords which might be applicable to that faculty member's research. Each keyword is its own field, and all of the keywords are Yes/No values.

An example [for arguments sake, using dummy keywords] runs like this, with the field names first:
Last: Miller
First: Larry
Blue: Yes
Red:
Green: Yes
Yellow:

Then the next entry, using those same fields, would be:
Last: Muldrich
First: Maria
Blue:
Red: Yes
Green: Yes
Yellow: Yes

My form has a list of all 54 keywords.
Suppose a faculty member wants the research interests "Blue" and "Red."
With the code I have now, neither Larry Miller nor Maria Muldrich would turn out, because neither one has BOTH Blue AND Red.

Instead, when a faculty member checks both "Blue" and "Red" on the form, I would like the query to return both Larry AND Maria, because they fit the criteria of having EITHER "Blue" OR "Red."
This is easy enough to do with just a query, put "True" in all the Or spots in the query.
Attaching this to the form is where I'm stuck. :banghead:

This was my original code:
(((IIf([forms]![Form1]![Check0],[Blue]=True,True))=True)) AND etc.

I tried changing the AND to OR in all of the lines. The query does not run at all and instead gives me my entire table.
 
Why not simply create a query and use that as the Record Source for another form thus displaying the results :confused:
 
I'm relatively new to Access.
I think I know what that means, but please explain to me how to do that.
I tried to make the query the Control Source for each checkbox but no options appeared in the Control Source dropdown menu
 
What you need to do is create a form and bind it to your query rather than a table.

In addition I'm going to reiterate Alansidman's suggestion that you read up on the subject of Data Normalisation and possibly also work through a tutorial on the subject.

With a normalised table structure you will find this sort of thing a whole lot easier.

Also, please DO NOT DOUBLE POST :mad:
 
I think that you are ignoring the advice of these gentlemen to normalise because they are being too gentle with you.
Back in the early 90s my first project on Access involved producing reports from an unnormalised database I inherited, it was a real pain in the arse, infact in the end I had to produce temp tables and do the queries from them.

Stop and normalise now before it is too late.

Brian
 

Users who are viewing this thread

Back
Top Bottom