MSAccessRookie
AWF VIP
- Local time
- Today, 11:17
- Joined
- May 2, 2008
- Messages
- 3,423
Have you tried using BOTH of the Form Fields in each test? It appears that in your sample data, when the data ranges overlap the dates selected on the Form, the selection is ignored. There are also some others that are not so easily explained.
In the sample code below, if either the Start Date or the End Date is in the range, it will be selected. If this does not get you what you are looking for, you should be able to play with the AND and OR Statements until you get what you want.
Code:
[FONT=Courier New]Range: 1929-1935[/FONT]
[FONT=Courier New][/FONT]
[FONT=Courier New]440 1927-1930 (1927 is outside the Range)
441 1931-1936 (1936 is outside the Range)
445 1928-1932 (1928 is outside the Range)
586 1930-1931 (no idea why this is not present)
427 1932-1934 (no idea why this is not present)
428 1934-1936 (1936 is outside the Range)[/FONT]
In the sample code below, if either the Start Date or the End Date is in the range, it will be selected. If this does not get you what you are looking for, you should be able to play with the AND and OR Statements until you get what you want.
Code:
(((Year([Start_Date]) >=[Forms]![SearchForm]![FormStart]) AND
(Year([Start_Date]) <=[Forms]![SearchForm]![FormEnd])) OR
((Year([End_Date]) >=[Forms]![SearchForm]![FormStart]) AND
(Year([End_Date]) <=[Forms]![SearchForm]![FormEnd])))