IIF and NULL

I

ismail

Please help me in this issue

if stidcmb value is 0 then i want run the query without any criteria.
IIf([Forms]![searchfrm]![stidcmb]=0,"",2)

this doesnt work..........

Thanks
 
D

Douglas J. Steele

I agree with Van that your question appears to have nothing to do with the
Subject. However, to answer just your question, put the following as the
criteria (assuming you're using the query builder grid):

[Forms]![searchfrm]![stidcmb] Or ([Forms]![searchfrm]![stidcmb]=0)

This should generate SQL along the lines of

WHERE (MyField = [Forms]![searchfrm]![stidcmb]) Or
([Forms]![searchfrm]![stidcmb]=0)
 
I

ismail

Success !
Thanks
in my query some places i have to give [stidcmb]="0"
and in some place like this
[stidcmb]=0

and in some place
[stidcmb]="All"

because i have my combo box condition ????


Many Thanks


Douglas J. Steele said:
I agree with Van that your question appears to have nothing to do with the
Subject. However, to answer just your question, put the following as the
criteria (assuming you're using the query builder grid):

[Forms]![searchfrm]![stidcmb] Or ([Forms]![searchfrm]![stidcmb]=0)

This should generate SQL along the lines of

WHERE (MyField = [Forms]![searchfrm]![stidcmb]) Or
([Forms]![searchfrm]![stidcmb]=0)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



ismail said:
Please help me in this issue

if stidcmb value is 0 then i want run the query without any criteria.
IIf([Forms]![searchfrm]![stidcmb]=0,"",2)

this doesnt work..........

Thanks
 
Top