I have q query, where one of the fields is a date (ranging from approx. 1880-1998).
I have previously received some assistance from 'John Big Booty' on this area, however I'm completely stock. When trying to use below nested IIF expression, I only get 3 results in the listbox, where the data is shown. All from December 1899.
CODE:Iif (IsNull([Forms]![FrmSearch]![StartDate]),<=Date() And <= [Forms]![FrmSearch]![EndDate], Iif(IsNull([Forms]![FrmSearch]![EndDate]), >=[Forms]![FrmSearch]![StartDate],Iif(IsNull([Forms]![FrmSearch]![StartDate]) And IsNull([Forms]![FrmSearch]![EndDate]), < Date() And > Date(), >=[Forms]![FrmSearch]![StartDate] And <= [Forms]![FrmSearch]![EndDate])))
The 4 parts (3 true and 1 false) it is checking for should be these:
1. Textbox 'StartDate' = Null & Textbox 'EndDate' = Not null
2. Textbox 'EndDate' = Null & Textbox 'StartDate' = Not null
3. Textbox 'StartDate' = Null & Textbox 'EndDate' = Null
4. Textbox 'StartDate' = Not null & Textbox 'EndDate' = Not null
If I use below expressions (one at the time), it works fine.
1. < [Forms]![frmSearch]![EndDate]
2. > [Forms]![frmSearch]![StartDate]
3. < Date()
4. Between [Forms]![frmSearch]![StartDate] And [Forms]![frmSearch]![EndDate]
I have also tried inserting specific dates in the nested IIF expression, and then it works fine, but when I use the nested IIF expression, a things go wrong, and I simply can't see why.
I hope that someone can give me a push in the right direction.
Thanks. /Anders
I have previously received some assistance from 'John Big Booty' on this area, however I'm completely stock. When trying to use below nested IIF expression, I only get 3 results in the listbox, where the data is shown. All from December 1899.
CODE:Iif (IsNull([Forms]![FrmSearch]![StartDate]),<=Date() And <= [Forms]![FrmSearch]![EndDate], Iif(IsNull([Forms]![FrmSearch]![EndDate]), >=[Forms]![FrmSearch]![StartDate],Iif(IsNull([Forms]![FrmSearch]![StartDate]) And IsNull([Forms]![FrmSearch]![EndDate]), < Date() And > Date(), >=[Forms]![FrmSearch]![StartDate] And <= [Forms]![FrmSearch]![EndDate])))
The 4 parts (3 true and 1 false) it is checking for should be these:
1. Textbox 'StartDate' = Null & Textbox 'EndDate' = Not null
2. Textbox 'EndDate' = Null & Textbox 'StartDate' = Not null
3. Textbox 'StartDate' = Null & Textbox 'EndDate' = Null
4. Textbox 'StartDate' = Not null & Textbox 'EndDate' = Not null
If I use below expressions (one at the time), it works fine.
1. < [Forms]![frmSearch]![EndDate]
2. > [Forms]![frmSearch]![StartDate]
3. < Date()
4. Between [Forms]![frmSearch]![StartDate] And [Forms]![frmSearch]![EndDate]
I have also tried inserting specific dates in the nested IIF expression, and then it works fine, but when I use the nested IIF expression, a things go wrong, and I simply can't see why.
I hope that someone can give me a push in the right direction.
Thanks. /Anders