Andy_Khosravi@bcbsmn.com wrote in
news:1128721209.958507.178470@o13g2000cwo.googlegr oups.com:
[color=blue]
> I have been trying to build a user friendly search engine for
> a small database I have created. I'm having some particular
> problems with one of my date fields.
>[/color]
[[SNIP]]
[color=blue]
> OR
> (((tblDptOwnerHist.DateEnd)=IIf(IsNull([forms]![frmsearch]![/color]
[dat[color=blue]
> eend1]),([tblDptOwnerHist].[DateEnd]) Is Null,#1/1/1801#)));
>
> All other parts of the query are working as intended. The only
> part of it that isn't working is the part after the OR
> statement.[/color]
At first glance, you have the statement
([tblDptOwnerHist].[DateEnd]) IS null nested in your IIF
statement.That won't work.
To handle the null, add a field to the grid:
exprN: Isnull([tblDptOwnerHist].[DateEnd]) AND
IsNull([forms]![frmsearch]![dateend1])
Make an entry on a separate criteria row of the word 'true'
without the quotes, which matches when both contain a date and
both are null. You use another criteria row to match the dates.
[color=blue]
> Any comments or suggestions will be greatly appreciated!
>
> On an unrelated side note, I have a sinking feeling that I'm
> going about this whole process in the most fantastically
> inefficient way possible. Comments about efficiency are also
> welcome =)
>[/color]
It is usually more efficient to build SQL for searching in code,
and only add the filters required.
--
Bob Quintal
PA is y I've altered my email address.