Error with IIF Query (1 Viewer)

safril

New member
Local time
Today, 14:12
Joined
Aug 7, 2021
Messages
14
Hi, I'm newbie in Access and I need help for my document.
So I have some data:
Name1
Name2
Name3
Name4

Then I want to make a query like this:
If Name1 and Name2 then smart;
If Name3 then less smart;
Others are stupid.
What is the correct formula for the above case? I used the below formula but they give me error report.

Formula 1
Code:
IIf([Your_Name]="Name1";"smart";IIf([Your_Name]="Name2";"smart";IIf([Your_Name]="Name3";"less smart";"stupid")))

Formula 2
Code:
IIf(Eval([Your_Name] In ("Name1","Name2"))),"smart";IIf([Your_Name]="Name3";"less smart";"stupid")

Please help 🙏
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 03:12
Joined
May 21, 2018
Messages
8,527
I think your formula1 looks correct, but debugging nested iifs is hard. You might be able to do it easier. I do not know what your real problem looks like. Can you explain what you really are doing.

Normally that would be in a table.

Name Level
Name1 Smart
Name2 Smart
Name3 Not so Smart
Name4
....
Name5
For your information most people in the forum will have regional settings the require commas in the code not semi colon. Some people may think that is wrong, but that may be correct for your region (delimiter).
 

Users who are viewing this thread

Top Bottom