Access - The Switch function

December 2016




Description


The Switch function allows you to evaluate a seriesof expressions and return a Variant value corresponding value for the first expression in the list, if condition is

True

Syntax


Switch ( expression-1, value-1, expression-2, value-2, ... expression-n, value-n )


E.g:
Switch ( Customer_ID=1, "John", Customer_ID=2, "Smith", Customer_ID=3, "Thomas")
  • If Customer_ID is equal to 1, the value returned will be "John"
  • If Customer_ID is equal to 3, the value returned will be "Thomas"

Related :

This document entitled « Access - The Switch function » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.