Im using the following to narrow down user searches for information.
Code:
>=[Forms]![Timesheets]![TxtFrom] And <=[Forms]![Timesheets]![TxtTo]
That's all well and good, but if these two text boxes are empty then I would like to "view all". Is there an easy way to do this?
If its fairly complex I don't want to be spending a lot of time on it. I could just change the default value of the text boxes to something that includes all records. 7
here is all the SQL for reference. as a note, I'm already filtering by a staff name selected via combo box.
Code:
SELECT PO_engineers.[PO Number], StaffT.Staff_Name, TimesheetData.Quantity_Hours, TimesheetData.Quantity_miles, TimesheetData.Quantity_Expenses, TimesheetData.Invoiced, TimesheetData.WeekEnding, StaffT.Staff_ID
FROM (StaffT INNER JOIN PO_engineers ON StaffT.Staff_ID = PO_engineers.Engineer_ID) INNER JOIN TimesheetData ON PO_engineers.PO_ID = TimesheetData.PO_ID
WHERE (((StaffT.Staff_Name)=[Forms]![Timesheets]![Combo22]) AND ((TimesheetData.Invoiced) Is Not Null) AND ((TimesheetData.WeekEnding)>=[Forms]![Timesheets]![TxtFrom] And (TimesheetData.WeekEnding)<=[Forms]![Timesheets]![TxtTo])) OR (((TimesheetData.Invoiced) Is Not Null) AND ((TimesheetData.WeekEnding)>=[Forms]![Timesheets]![TxtFrom] And (TimesheetData.WeekEnding)<=[Forms]![Timesheets]![TxtTo]) AND (([Forms]![Timesheets]![Combo22]) Is Null))
ORDER BY TimesheetData.WeekEnding;