IIF statement

JPW

Registered User.
Local time
Today, 18:33
Joined
Nov 4, 2007
Messages
51
I have a field in my query called 'Disposed', but it is unbound so it also has the text 'Expr 1' next to it, as no point having a field in the table in my database to save space.

Anyway, I also have in my query the field 'Collected by'.

I have in the criteria of my 'Disposed' coloumn the following code: =IIf([collected by]="OWNER COLLECTED","YES")

This code however, is not working in my query.

Any help very welcome, thanks.
 
Check the format of the IIF command. You need to supply Condition,Value if true,Value if false. It looks if you haven't supplied the false value.
 
Check the format of the IIF command. You need to supply Condition,Value if true,Value if false. It looks if you haven't supplied the false value.

I've tried =IIf([collected by]="AUTOSALVAGE","YES","")

However if false i don't want any text to be displayed. I'm only interested in the "YES" yes part of things. When I mean it's not working, I mean I get the 'Enter paramater value box'. So Imusst be doing something wrong
 
I've tried =IIf([collected by]="AUTOSALVAGE","YES","")

However if false i don't want any text to be displayed. I'm only interested in the "YES" yes part of things. When I mean it's not working, I mean I get the 'Enter paramater value box'. So Imusst be doing something wrong
It looks like you haven't used the correct field name in the []
 
Don't you require in your query a field
Disposed:=IIf([collected by]="OWNER COLLECTED","YES"," ")

Brian
 
Okay, I tried Brian's soloution, but not fully working.

The paramater box no longer appears, but no results show up in my query.

I had a column in the design view of my query called 'Disposed' This did not link to any table so was kinda unbound. Then as soon as I leave the field, Access changes it to Expr1: [Disposed]

I have another column called 'Collected by'.

I tried to put the above code into the criteria section of the 'Disposed' column, but when I save the query and re-enter I get a new column with the Disposed: thing as a new field and the rest of the code in the criteria. Anyway, it still doesn't work :(
 
Thank you

I'm so sorry, I was putting the iif code into the criteria box and not the actual field.

It all works now

thank you!
 

Users who are viewing this thread

Back
Top Bottom