Hello to all ,
From the morning until now i am trying to get done a search query that takes four parameters
The employee name , start and end date of the annual leave as also the annual leave type.
The query basicly is working but it does not take the real BETWEEN values between start and end date.
As i realised when i search for a start end end date i want the search to get results in any correlated dates .
Here is my query:
SELECT Main.MainID, Employee.EmployeeName, Main.StartDate, Main.EndDate, LeaveType.LeaveType
FROM Season INNER JOIN (LeaveType INNER JOIN (Employee INNER JOIN Main ON Employee.EmployeeID = Main.EmployeeID) ON LeaveType.LeaveID = Main.LeaveID) ON Season.SeasonID = Main.SeasonID
WHERE (Employee.EmployeeName Like Forms!SearchForm!EmployeName & "*" or Forms!SearchForm!EmployeName Is Null)
And (LeaveType.LeaveType Like Forms!SearchForm!LeaveType & "*" or Forms!SearchForm!LeaveType Is Null)
BETWEEN (Main.StartDate Like Forms!SearchForm!StartDate & "*" or Forms!SearchForm!StartDate Is Null)
And (Main.EndDate Like Forms!SearchForm!EndDate & "*" or Forms!SearchForm!EndDate Is Null);
The join was mannualy done by access but the type of query was by me manualy typed
The issue here is the start and end date, the between is not actually working as when i search for example start date is 24/02/2012 and end date 31/08/2012 i am not getting between results , i will get the start date result as also any date that equals the end date.
My first thought is about the join type but i have changed all the joins type and i am anot getting any different results.
My second is about the between statement , if is correct statement that i am doing.
Any thoughts ,recommendation and help would be welcome.
Thank you