dpelizzari
IS-IT--Management
I have built a form that filters data between two dates (start date, end date) as well as another criteria (site code). If the user puts in the start and end date, they can retrieve all records in that range, however, if they leave the date fields blank, they get no records returned. What I would like it to do is if either date field is null, to pull all records either before or after the dates respectively.
In a nutshell:
If start date is null, and end date is not null, select all records before end date and apply site code filter if necessary.
If start date is not null and end date is null, select all records after start date and apply site code filter if necessary.
Here is my filter code currently:
Note, I am using a form to capture the data before opening the form that presents the data.
In a nutshell:
If start date is null, and end date is not null, select all records before end date and apply site code filter if necessary.
If start date is not null and end date is null, select all records after start date and apply site code filter if necessary.
Here is my filter code currently:
Code:
WHERE ((([dbo_ISD SACD1].epend_dt)>=[Forms]![Parameters]![StartDate] And ([dbo_ISD SACD1].epend_dt)<=[Forms]![Parameters]![EndDate]) AND (([dbo_ISD SACD1].rSite) Like Nz([Forms]![Parameters]![Site Code],"*")));
Note, I am using a form to capture the data before opening the form that presents the data.