IIF Statement in Query Field Criteria

D

dhod

I am creating a database to retrieve performance information at different
levels. The lowest level is an individual area, then going to a group area,
then to a building level. I am trying to limit the number of queries by
pulling it all off with conditional criteria. The query criteria is
dependent on the value selected from a combo box in a form. To generalize,
Areas are: North, South, East, and West. Groups are Longitude and Latitude.
Longitude consists of North and South, Latitude consists of East and West.
If a person selects N, S, E, or W the IIF works fine. But my code is not
working if Long or Lat is selected. The code is:

IIf([Forms]![Direction Report]![Direction]="Longitude","North" Or
"South",[Forms]![Direction Report]![Direction])

I have also tried placing "Like" in the condition true part with no change.

Any suggestions??

Thank you,

Daniel.
 
K

KARL DEWEY

What is your table structure - table and field names with datatype. Post
sample data. What are the choices that can be selected from a combo box in a
form?
 
D

dhod

To anyone who may have this issue due to Access inexperience.... I removed
the Or and addtional direction from the IIF, then added another IIF in the
"Or" spot in the query design:

Not Working:

Criteria: IIf([Forms]![Direction Report]![Direction]="Longitude","North" Or
"South",[Forms]![Direction Report]![Direction])

Working:

Criteria: IIf([Forms]![Direction
Report]![Direction]="Longitude","North",[Forms]![Direction
Report]![Direction])

Or: IIf([Forms]![Direction
Report]![Direction]="Longitude","South",[Forms]![Direction
Report]![Direction])

I am still interested if anyone knows how to make my original attempt work.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top