 Yoko Brolly Dolly

Joined: 25 Feb 2007 Karma :     
|
|
 Kickstart The Oracle

Joined: 04 Feb 2002 Karma :     
|
|
 JonB Afraid of Mileage

Joined: 03 Jun 2004 Karma :  
|
 Posted: 11:30 - 23 Nov 2007 Post subject: |
 |
|
And why would you be using database software?
Haven't got 2 new CD's recently have you?  ____________________ Be careful whose advice you buy, but, be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than it?s worth. |
|
 Yoko Brolly Dolly

Joined: 25 Feb 2007 Karma :     
|
 Posted: 11:58 - 23 Nov 2007 Post subject: |
 |
|
| Kickstart wrote: | Hi
Err, that isn't IIF syntax.
Should be iif ( condition, value_if_true, value_if_false ).
Yours seems to be saying if True is True then return "Is Null Or Is Not Null" (god knows what it would try and return).
All the best
Keith |
Err not really, the condition is a questions which returns true or false, I've simply left out the question and given it the answer.
Eg:
IIf ( True, do a, do b ) will 'do a' likewise
IIf ( False, do a, do b ) will 'do b'
I dont actually use that statement in my query, it was just do demonstrate that 'Is Not Null' doesnt work when imbedded in an IIf statement.
Why can I use it in normal criteria and not in an if statement. Doesnt make sense to me.
What I want is an IIf statement that if a button in my form is ticked no criteria is specified (and therefore everything is returned), if its unticked then a list box becomes enabled and the user specifies a criteria from the list box which is then passed to the criteria in the query.
'Is Null or Is not Null' returns everything, which is what I want it to do if the button is ticked.
Is null = Everything that is empty
Is not null = Everything that is not empty
Is null or is not null = Everything that is empty or is not empty
Saying IIf ( 'button ticked' (aka true ) , , 'criteria from list box')
Is the same as saying...
IIf ( 'button ticked', "", 'criteria from list box')
In which case when the button is ticked it will return everything with an empty string in that field. Which is not what I want...
Anyway I've now overcome my problem a different way but still doesnt make sense why you can say "something" in an IIf statement but not 'is null' or 'is not null' or 'is null or is not null'
| Jon B wrote: | And why would you be using database software?
Haven't got 2 new CD's recently have you? |
 ____________________ Sheep Shagger |
|
 Kickstart The Oracle

Joined: 04 Feb 2002 Karma :     
|
|