Results 1 to 3 of 3

Thread: What is the CASE statement syntax?

  1. #1
    Join Date
    Aug 2005
    Posts
    8

    What is the CASE statement syntax?

    Dear All,

    May i know what is the syntax to writer the CASE statment in MS ACCESS?
    Is the MS ACCESS can support for this CASE function?

    Thanks.

    Regards,
    Wil

  2. #2
    Join Date
    Sep 2005
    Location
    Buffalo NY
    Posts
    5
    Case
    When [argument] Then [Result] End as [column name]

    Or
    Case
    When [Argument] Then [Result] Else [Result] End as [Column name]

    However, Access SQL does not really work with the Case Else, you must use

    IIF(condition, truepart, falsepart)

    You can nest the IIFs( Up to seven) by following this pattern

    IIF(Condition, truepart,IIF(Condition, truepart,IIF(condition, truepart... and so forth...just make sure to close all the parenthesis at the end

    You first CASE is the first condition, the first true part is the desired THEN output, the first nested IIF would be the ELSE part

    You can use the "build" option by right clicking in the column selection area of the query window or the criteria row of the query window..or type directly into SQL by switching to that view.

  3. #3
    Join Date
    Aug 2005
    Posts
    8

    Thanks.

    Thanks you so much, i try to work it out and will reply to you soon!!
    Thanks.

    Rgds,
    WilmosLee.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •