From the course: Access 2021: Queries
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Use the Switch() function
From the course: Access 2021: Queries
Use the Switch() function
- [Instructor] Within the program flow category of functions in the expression builder is another function called SWITCH. The SWITCH function is similar to IF in that it allows access to return various responses depending on the results of an evaluated expression. The difference between IF and SWITCH though is that SWITCH include multiple expressions 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. I'll start a new query in design view. Now let's suppose that we have a customer loyalty program that assigns different levels or awards as each customer purchases more products. We want to find out how our customers rank within the loyalty program. For this query, I'll need to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.