X
xsdaver
I've been tearing my hair out... no doubt a familiar situation for beginners.
After much hair loss, I have ended up with a form that has three fields on
it that I'm trying to use to set a query criteria for the query that provides
the data for the form. The field I'm trying to filter on is [Date Sold]. It
all works if the criteria is:
Between [Forms]![Item Details]![txtDateSoldFilter1] And [Forms]![Item
Details]![txtDateSoldFilter2]
or
Like "*" or Is Null
but if I use:
IIf([Forms]![Item
Details]![chkFilterDateSold]=Yes,"#7/16/1008#","#7/23/2008#")
I get the error message: "The expression is typed incorrectly, or it is too
complex to be evaluated. For example, a numberic expression may contain too
many complicated elements. Try simplifying the expression by assigning parts
of the expression to variable."
What I've been trying to get to now is:
IIf([Forms]![Item Details]![chkFilterDateSold]=Yes,"""" Between " &
[Forms]![Item Details]![txtDateSoldFilter1] & " And " & [Forms]![Item
Details]![txtDateSoldFilter2]","Like " & """*""" & " Or Is Null")
which will hopefully show me records that fall between two dates or
everything. I'll also need to be able to show only those records where [Date
Sold] is null, or not sold.
After much hair loss, I have ended up with a form that has three fields on
it that I'm trying to use to set a query criteria for the query that provides
the data for the form. The field I'm trying to filter on is [Date Sold]. It
all works if the criteria is:
Between [Forms]![Item Details]![txtDateSoldFilter1] And [Forms]![Item
Details]![txtDateSoldFilter2]
or
Like "*" or Is Null
but if I use:
IIf([Forms]![Item
Details]![chkFilterDateSold]=Yes,"#7/16/1008#","#7/23/2008#")
I get the error message: "The expression is typed incorrectly, or it is too
complex to be evaluated. For example, a numberic expression may contain too
many complicated elements. Try simplifying the expression by assigning parts
of the expression to variable."
What I've been trying to get to now is:
IIf([Forms]![Item Details]![chkFilterDateSold]=Yes,"""" Between " &
[Forms]![Item Details]![txtDateSoldFilter1] & " And " & [Forms]![Item
Details]![txtDateSoldFilter2]","Like " & """*""" & " Or Is Null")
which will hopefully show me records that fall between two dates or
everything. I'll also need to be able to show only those records where [Date
Sold] is null, or not sold.