Didn't import the data directly, I'm going to input the data or transfer it over by hand at a later point when I have most of the framework and forms of the database actually built. So right now I have four tables:
1. Company table with stuff like a name, company id, notes, website
2. Contact table with stuff like company id, first name, last name, position, phone, email
3. Certifications, with Yes/No based on whether a checkbox is checked or not
4. Services offered, with a Yes/No based on whether a checkbox is checked or not.
Tables 2-4 are linked in a one to many relationship with the Company table through the company ID. So for the test data I put in, there are three companies. A, B, C, each of these have survey, and geotech skills.
Company A has geotech checked, company B has survey checked, and company C has both checked.
The query which I'm running is this:
Code:
SELECT companyDatabase.[Company Name], servicesOffered.[Survey/Right-of-Way], servicesOffered.[Geotech Engineering]
FROM companyDatabase INNER JOIN servicesOffered ON companyDatabase.[Company ID] = servicesOffered.[Company ID]
WHERE (((servicesOffered.[Survey/Right-of-Way])=IIf([Forms]![test]![checkSurvey]=-1,-1,0))) OR (((servicesOffered.[Geotech Engineering])=IIf([Forms]![test]![checkGeotech]=-1,-1,0)));
This is what SQL view gives me.
Now my issue becomes is if I put the AND operator instead of OR, whenever I click a single checkbox, it'll only return a company which has exactly only one service offered even if other companies have that service. If I put the OR operator, if I look for a company with multiple services, it returns everything because only one of the conditions has to be true.
For example, if I check the survey checkbox, and not the geotech one, it'll return fine with OR, but not with AND
if I check the geotech but not the survey, it'll return fine with OR, but not with AND
If I check both boxes, it'll return all companies rather than company C which has both checked.
I understand why it's failing the way it is, but based on my limited knowledge of Access, it's what I have to work with. So, my question is if there's any way to create the search the way I need it to be.