R
Richard Horne
Hi guys, I have the following query:
SELECT Quotations.QuotationID, Quotations.Date,
Quotations.Quotation_Customer_Lookup, Quotations.[Your Reference],
Quotations.QuotationBy, Quotation_Details.[Item No],
Quotation_Details.Product_lookup, Quotation_Details.[Full Description],
Quotation_Details.[Type/Colour/Size], Quotation_Details.Quantity,
Quotation_Details.[Denomination Lookup], Quotation_Details.Price
FROM Quotations INNER JOIN Quotation_Details ON Quotations.QuotationID =
Quotation_Details.QuotationID
WHERE (((Quotations.Quotation_Customer_Lookup) Like "*" & [cboCompanyName])
AND ((Quotations.[Your Reference]) Like "*" & [QuoteRef]) AND
((Quotations.QuotationBy)=[cboQuoteBy]) AND
((Quotation_Details.Product_lookup) Like "*" & [cboProduct]) AND
((Quotation_Details.[Full Description]) Like "*" & [txtDescription] & "*")
AND ((Quotation_Details.[Type/Colour/Size]) Like "*" & [txtTypeColourSize] &
"*"))
ORDER BY Quotations.QuotationID DESC;
This filters out results according to selections made in combo boxes or by
text typed in txt boxes. But the results are only shown if two or more boxes
are filled in. What do I need to do to this query to make it so?
For example, one of the fields cboCompanyName contains a list of all our
customers. This query should show all quotations for the company chosen in
the list, but at the moment it will only show results if one of the other
querying combo/text boxes is filled in. I assume this is something to do with
the ANDs but I'm not sure.
SELECT Quotations.QuotationID, Quotations.Date,
Quotations.Quotation_Customer_Lookup, Quotations.[Your Reference],
Quotations.QuotationBy, Quotation_Details.[Item No],
Quotation_Details.Product_lookup, Quotation_Details.[Full Description],
Quotation_Details.[Type/Colour/Size], Quotation_Details.Quantity,
Quotation_Details.[Denomination Lookup], Quotation_Details.Price
FROM Quotations INNER JOIN Quotation_Details ON Quotations.QuotationID =
Quotation_Details.QuotationID
WHERE (((Quotations.Quotation_Customer_Lookup) Like "*" & [cboCompanyName])
AND ((Quotations.[Your Reference]) Like "*" & [QuoteRef]) AND
((Quotations.QuotationBy)=[cboQuoteBy]) AND
((Quotation_Details.Product_lookup) Like "*" & [cboProduct]) AND
((Quotation_Details.[Full Description]) Like "*" & [txtDescription] & "*")
AND ((Quotation_Details.[Type/Colour/Size]) Like "*" & [txtTypeColourSize] &
"*"))
ORDER BY Quotations.QuotationID DESC;
This filters out results according to selections made in combo boxes or by
text typed in txt boxes. But the results are only shown if two or more boxes
are filled in. What do I need to do to this query to make it so?
For example, one of the fields cboCompanyName contains a list of all our
customers. This query should show all quotations for the company chosen in
the list, but at the moment it will only show results if one of the other
querying combo/text boxes is filled in. I assume this is something to do with
the ANDs but I'm not sure.