I am running a query form a form. I want to be able to display all records if no date is entered or the records between two dates if dates are entered.
In the criteria section of the query I have the code Like IIf(IsNull([forms]![leaveinfo]![text25]),"*",[Data]![Date of Absence] Between [Forms]![leaveinfo]![Text27] And [Forms]![leaveinfo]![Text25])
Text 25 is the start date and text27 is the end date.
If I run the query using just bewteen it works fine at retrieving the records between the two dates. If I use the IIf statement and leave the date field blank then all records are returned. If I use the IIf statement and enter dates no records are returned. Any Ideas?
In the criteria section of the query I have the code Like IIf(IsNull([forms]![leaveinfo]![text25]),"*",[Data]![Date of Absence] Between [Forms]![leaveinfo]![Text27] And [Forms]![leaveinfo]![Text25])
Text 25 is the start date and text27 is the end date.
If I run the query using just bewteen it works fine at retrieving the records between the two dates. If I use the IIf statement and leave the date field blank then all records are returned. If I use the IIf statement and enter dates no records are returned. Any Ideas?