i had a form (form2) with a listbox that displays the numbers from 1-12(representing the number of month) and a txtbox on which the user enters the year.
now i want to run a query with the criteria taken from this form ,that displays all the orders in the case of both listbox and txtbox are blank. in case that the user fills only the listbox(months)display all the orders that were made in that month at every year and finally in the case that he only fills the textbox(year) display all of the orders of that year
so far i have managed to make it work with the listbox (month)selected and both (listbox and textbox) blank but with regards to the textbox(year) i hasn't be able to make it work
any help will be appreciated
for more details i leave here the sql code an a picture of how it looks the query
thank you
Expand|Select|Wrap|Line Numbers
- SELECT orders.[or-id], Sum([quantity_x_price_qry(help)].subtotal) AS SumOfsubtotal, orders.DateEntered, Month([orders]![DateEntered]) AS jodesh, Year([orders]![DateEntered]) AS shana, customers.FirstName, customers.LastName
- FROM customers INNER JOIN ([quantity_x_price_qry(help)] INNER JOIN orders ON [quantity_x_price_qry(help)].[or-id] = orders.[or-id]) ON customers.[cust-id] = orders.[cust-id]
- GROUP BY orders.[or-id], orders.DateEntered, Month([orders]![DateEntered]), Year([orders]![DateEntered]), customers.FirstName, customers.LastName
- HAVING (((Month([orders]![DateEntered]))=[Forms]![Form2]![Monthtxt] Or [Forms]![Form2]![Monthtxt] Is Null) AND ((Year([orders]![DateEntered]))=[Forms]![Form2]![YearTxt] Or [Forms]![Form2]![YearTxt] Is Null));