Case Statement in Access

  • Can you use a case statement in Access 2003?

  • Where do you want to use it?

    It's not available in Access SQL (AFAIK), but it is available in VBA. Or if you use a passthru query to a SQL Server db, it's also OK.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • For Access SQL use either the IIF( <condition>, <true expression>, <false expression> ), which can be nested (that is the condition or the true/false expresssions can also be IIF's),  or use the Choose( <number>, <expression when 1>, <expression when 2>, ..., <expression when n> ) function to return an expression from the value of the number.

    If using VBA try the Select Case ... End Case statement.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply