From the course: Access 2016: Queries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Use the Switch() function

Use the Switch() function

From the course: Access 2016: Queries

Start my 1-month free trial

Use the Switch() function

- [Voiceover] Within the Program Flow category of functions within the Expression builder, There's another function called Switch. The Switch function is similar to IIF in that it allows Access to return various responses depending on the results of an evaluated expression. The difference between IIF and switch is that the switch function includes multiple expression and return pairs, in a sort of decision tree that only branches in the false direction. In other words, Access reads through the function and returns the first true condition that it happens upon. If the condition evaluates to false, Access proceeds to the next condition. Let's take a look at an example. Let's suppose that we have a recognition program that assigns different levels or rewards at different sales milestones. We want to find out how our team members rank within the recognition program. Now we've got this query here called Employee Lifetime Sales Complete that we created earlier in the course. You might…

Contents