I have two date columns [ServiceStartDate] and [ServiceEndDate] in my data base. I am trying to run a query that either makes the date of the enquiry period [Start Date] as the [ServiceStartDate] where that date is prior to the Enquiry date [Start Date] or if the [ServiceStartDate] is equal to or after the Enquiry date then to use the [ServiceStartDate].
In Design view of the [ServiceStartDate] column, in the criteria row I have entered >=[Start Date] and in the or row I have entered IIf([ServiceStartDate]<[Start Date],[Start Date])
So I have ended up with an SQL stating
WHERE (((T_Placements.ServiceStartDate)>=[Start Date]) AND ((T_Placements.ServiceEndDate)<=[End Date])) OR (((T_Placements.ServiceStartDate)=IIf([ServiceStartDate]<[Start Date],[Start Date])) AND ((T_Placements.ServiceEndDate)=IIf("IsNull",Date() )))
If I use only the >=[Start Date] the query works with all dates after the date of Query but when I add the 2nd parameter it does not return anything.
Can anyone help?