Link to home
Start Free TrialLog in
Avatar of Delores_C
Delores_CFlag for United States of America

asked on

Query in Access 2007

Field1 = Type (text field)
Field2 = DOA (Date field)
Field3 = TypeAddress (Text field)


New Field:=IIF([Type]=”92”,[DOA])

I need the NewField to show the DOA field if the Type equals 92
Avatar of mbizup
mbizup
Flag of Kazakhstan image

What should it be if Type is not 92?

This shows a blank:

IIF([Type]=”92”,[DOA], "")
Avatar of Delores_C

ASKER

I do not want anything to show
Avatar of Norie
Norie

Are the slanted quotes a typo?

Have you tried single quotes?

NewField:Iif([Type]='92', [DOA], '')

Okay - the above should work for you.  Just use that as an expression for a new field:

NewField: IIF([Type]=”92”,[DOA], "")
>> Are the slanted quotes a typo?

Good catch.  I bet they were copied in from MS Word.  I wonder if they make a difference?
Not working, this is an exact copy of the query I have.  

PatDOB: IIf([Reference]="PROGRESSIVE",[DateOfBirth],"")

The Reference is the Provider name field , the "Progressive" is the name of the provider and the DateOfBirth is the field I want to show only if the provider name is Progressive.
'Not working' how?

Error? Incorrect result? Crashing database?

What is it showing?
I am not getting anything in the field.  Could it be because the results is a date field and the criteria is a text field?
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The field types shouldn't matter.

Where are you using this expression?

Query? Form? Report?
Is Reference defined as a lookup field?

If so, you have to test for its (probably numeric) ID value, not the visible value.
it's working, thanks alot!
Good deal :)
Excellent instructions