so I have a an Excel spreadsheet imported into Access as a table and I am wanting to search this table on different criteria via a search from. The search from needs to search for specific criteria using the AND function but also to perform a text search over multiple fields as an OR function (like a keyword type search)
I can run these 2 queries separately using 2 different buttons but I cant run them together as then I combine the AND and OR searches in one query the whole query runs as an OR so I don't the results I want.
In essence the result I want must have X and Y and F and "NADCAP"(NADCAP could be in up to 6 fields) I have created a union query which works but as an OR query rather than what I need....
Soooo. Is there a way for me to run the AND query first and use the results of this to then do the keyword search and find all records that match all criteria?
I think it could be done by maybe using a sub query or a derived table? or using the 1st query result as the FROM or SELECT fields?
I know the proper and best way to do this is to build a database with correct tables etc but I was hoping that there could be a work around via a query as I have zero experience in building databases really...just from what I've read on forums like this when I get stuck!!
my AND query
SELECT [CP data].[Company name], [CP data].[UK head office address], [CP data].[Other UK addessses], [CP data].[UK manufacturing operations], [CP data].[Company URL], [CP data].[Oil and Gas], [CP data].Renewables, [CP data].Aerospace, [CP data].[Medical & Pharmaceuticals], [CP data].Automotive, [CP data].Rail, [CP data].Chemical, [CP data].Accreditations1, [CP data].Accreditations2, [CP data].Accreditations3, [CP data].Accreditations4, [CP data].Accreditations5, [CP data].Accreditations6, [CP data].[Full Assembly], [CP data].Component, [CP data].OMR
FROM [CP data]
WHERE ((([CP data].[Full Assembly]) Like "*" & [Forms]![Search]![Full Assembly] & "*") AND (([CP data].Component) Like "*" & [Forms]![Search]![Component] & "*") AND (([CP data].OMR) Like "*" & [Forms]![Search]![OMR] & "*"));
My OR query
SELECT [CP data].[Company name], [CP data].[UK head office address], [CP data].[Other UK addessses], [CP data].[UK manufacturing operations], [CP data].[Company URL], [CP data].[Oil and Gas], [CP data].Renewables, [CP data].Aerospace, [CP data].[Medical & Pharmaceuticals], [CP data].Automotive, [CP data].Rail, [CP data].Chemical, [CP data].Accreditations1, [CP data].Accreditations2, [CP data].Accreditations3, [CP data].Accreditations4, [CP data].Accreditations5, [CP data].Accreditations6, [CP data].[Full Assembly], [CP data].Component, [CP data].OMR
FROM [CP data]
WHERE ((([CP data].Accreditations1)=[Forms]![Search]![Accreditation])) OR ((([CP data].Accreditations2)=[Forms]![Search]![Accreditation])) OR ((([CP data].Accreditations3)=[Forms]![Search]![Accreditation])) OR ((([CP data].Accreditations4)=[Forms]![Search]![Accreditation])) OR ((([CP data].Accreditations5)=[Forms]![Search]![Accreditation])) OR ((([CP data].Accreditations6)=[Forms]![Search]![Accreditation]));
Thanks