Forum Discussion

Ganesh99's avatar
Ganesh99
Copper Contributor
Jan 12, 2023

Switch function in Access is not evaluating more than 2 conditions

Hello All,   Assume a table has columns Description, SO and Region.   Column5: Switch([description]=[SO],"L2L",[region]="Bangalore" Or "ROK","K2L",[region]="East" Or "West" Or "North" Or "South",...
  • Karl_Donaubauer's avatar
    Jan 12, 2023

    Hi,

     

    The syntax for the OR operator is wrong. You would have to repeat the full comparison for every value, i.e. [region]="Bangalore" Or [region]="ROK" etc. With more than 1 value it's easier to use the IN operator. If I  understand your intention correctly, then this should work:

     

    Switch([description]=[SO],"L2L",[region] IN ("Bangalore", "ROK"),"K2L",[region] IN ("East", "West","North","South"),"L2L")

     

    Servus
    Karl
    ****************

    Access Bug Trackers

    Access News
    Access DevCon

     

Resources