IF ElseIF Statement

  • Thread starter Thread starter Carin Bunney
  • Start date Start date
C

Carin Bunney

What is wrong with this statement?

SELECT Registration.ID,
IIf (Registration.A10 = Yes, A10) as ClassA
ElseIF
IIf (Registration.A11 = Yes, A11) as ClassA
end if
from registration
 
Hi Carin,

Hate to tell you this. There is no "Elseif" in IIF.
Syntax for IIF,

IIF(Condition, ThenResult, ElseResult)

If I read you code correctly,

Select Registration.ID,
IIF(Registration.A10 = Yes, A10, IIF(Registration.A11 = Yes, A11, Null)) As
ClassA
from registration;

Hope this helps.
 
What is wrong with this statement?

SELECT Registration.ID,
IIf (Registration.A10 = Yes, A10) as ClassA
ElseIF
IIf (Registration.A11 = Yes, A11) as ClassA
end if
from registration

Just the fact that Access does not support If - ElseIf - End If
constructs in queries; and the IIF() function has three arguments
(expression, result-if-true, result-if-false) rather than two.

Could you explain what your table contains and what result you want in
ClassA?

John W. Vinson[MVP]
 
Back
Top