There’s a form in our db which allows users to run a query for all the records based upon a few fields they’ve input on the form. Below is the query that gets run from the form. It was working fine until I added the last line because they wanted to be able to filter by Product Category. It still works but I am now not getting everything that I used to get. What I found was that a bunch of records have NULL values for Product Category and these records are excluded from the query if the user doesn’t select something for Product Category on the form. So, if the user inputs a value for Team Assigned they’ll get back all of the records which match that Team except for the records where Product Category is NULL.
Do you know how I can update the query so that the NULL Product Category records are also returned when a Product Category is not selected on the form? Let me know if you need any other information. Thanks.
SELECT tbl_OnlineOrders.*
FROM tbl_OnlineOrders
WHERE (((tbl_OnlineOrders.Order_Num) Like "*" & [Forms]![frm_OrderForm]![Text_OrderNumber] & "*")
AND ((tbl_OnlineOrders.Team_Assigned) Like "*" & [Forms]![frm_OrderForm]![Text_Team] & "*")
AND ((tbl_OnlineOrders.Product_Category) Like "*" & [Forms]![frm_OrderForm]![Text_Category] & "*"));
Do you know how I can update the query so that the NULL Product Category records are also returned when a Product Category is not selected on the form? Let me know if you need any other information. Thanks.
SELECT tbl_OnlineOrders.*
FROM tbl_OnlineOrders
WHERE (((tbl_OnlineOrders.Order_Num) Like "*" & [Forms]![frm_OrderForm]![Text_OrderNumber] & "*")
AND ((tbl_OnlineOrders.Team_Assigned) Like "*" & [Forms]![frm_OrderForm]![Text_Team] & "*")
AND ((tbl_OnlineOrders.Product_Category) Like "*" & [Forms]![frm_OrderForm]![Text_Category] & "*"));