I also started with creating a filter portion for dates, but all this code is really unnecessary, so I came up with this approach:
1) dump this sql into a new query to see the calculated field and criteria expression
Code:
SELECT tblImportVacanciesByPerson.[Person Number], tblImportVacanciesByPerson.[Vacancy ID], tblImportVacanciesByPerson.[Person Name], tblImportVacanciesByPerson.[Action code], tblImportVacanciesByPerson.[Action Reason], CDate([Effective Date]) AS Expr1, tblImportVacanciesByPerson.[Business Unit], tblImportVacanciesByPerson.Department, tblImportVacanciesByPerson.Supervisor, tblImportVacanciesByPerson.[Job code], tblImportVacanciesByPerson.[Job Title]
FROM tblImportVacanciesByPerson LEFT JOIN tblAllVacanciesWithRequisitions ON tblImportVacanciesByPerson.[Vacancy ID] = tblAllVacanciesWithRequisitions.VACANCY_ID1
WHERE (((CDate([Effective Date])) Between [forms]![frmVacanciesWithNoRequisitionParameters].[txtReqCreationStartDate] And [forms]![frmVacanciesWithNoRequisitionParameters].[txtReqCreationEndDate]) AND ((tblAllVacanciesWithRequisitions.VACANCY_ID1) Is Null))
ORDER BY tblImportVacanciesByPerson.[Vacancy ID];
2) format the two date controls as short date and use the calendar to force users to pick a system formatted date (for me this is mm/dd/yyyy)
3) test your new query with different dates when the form is in form view (seemed to work for me). When working, you can set the other query fields to reference the form controls in the same way, allowing you to remove all the coded filters
4) you'll have to set the report recordsource to this revised query and remove any filters you're applying
The query should filter against the chosen dates without having to worry about trying to format them. It's my belief that the issues are thus:
- you cannot compare the data by converting a string date using DateValue to a string that has simply been reformatted to "look" like a date. It's my belief that formating a date data type is one thing, but applying a format to a date string does not convert it to a date data type.
Aside from that, try to learn how to use the same form to open one report (or other form) using queries as filters, or by applying a filter to the report/form being opened rather than have a one-to-one relationship between them. You should be opening such objects in this manner rather than creating multiple objects in order to see different data sets.