# Logical Operators, If Then Else and Select Case Statements, Looping and Counting

Views: 401
One of the goals of computer programming is telling the computer what to do when something occurs, and how to do it. This is performed by setting conditions, examining them and stating what decisions the computer should make. To perform the necessary conditions, you have two main options: Microsoft Access or Microsoft Visual Basic.

Microsoft Access is equipped with a series of operators and functions destined to perform various operations. To use a condition in Microsoft Access, if you know the structure of the conditional statement, you can write it after typing an assignment operator. Because most conditions in Microsoft Access are in the form of functions, we will study them later on. For now, we will learn how to write conditions in the Microsoft Visual Basic language.

## Logical Operators in Access SQL

Originally, logical operators were a concept from algebra used to exclude and include number sets. They are, very simply, NOT, AND, and OR. Sometimes this set is expanded to combinations of the operators, but at core it's only these three. The logical operators are often referred to as the Boolean operators.

## Table of operators

An operator is a sign or symbol that specifies the type of calculation to perform within an expression. There are mathematical, comparison, logical, and reference operators. Access supports a variety of operators, including arithmetic operators such as +, -, multiply (*), and divide (/), in addition to comparison operators for comparing values, text operators for concatenating text, and logical operators for determining true or false values. This article provides details about using these operators.

## Microsoft Access Select Case Statement

Microsoft Access is a very versatile data-handling tool. There are numerous control statements that turn the program flow based on the value of certain expressions. Such statements are the Select Case statement, If...Then...Else statements, the For Loop etc.
The Select Case statement is the multiway branching statement. If the probable actions based on the value of a variable are numerous, this statement is used. It is an easy way to send execution to different parts of the code depending on an expression.

## Exploring Data Analysis

To further enhance your filtering capabilities, you can use Boolean algebra combined with the operators we have used so far. Besides the logical operators we know already, Boolean algebra adds extra operators used to concatenate expression.

## Database Operators and Operands

The fields we have been using allow the user to enter, view, or change data of a database. Because there is so many types of values a user can be ask to deal with, the values in the fields are categorized by types. Learn: Overview of Operators and Operands, Constants, Operators, Logical Operators.

## Looping with For Each Statements

This tutorial will teaches you how to Looping with For Each Statements. (video tutorial)

## Query Criteria In Access 2010 Through Logical Operators

As the name implies, Query pulls out specific data from table fields included in database, thus, setting specific criterion in query helps you to filter down the table field data according to your needs. Through simple logical operators in Query Criteria you can set a criteria by using simple AND/OR operators, which lets you to confine the results of a query based upon the query criteria to check which table field data is to be included.

## How can I use Select Case Statements with multiple variables?

I need some help in understanding why I keep getting an error message called "invalid use of Null" when I run this code.

Brief summary: I have 5 check boxes for 5 different machine models (R610,R620, R630,R670, R690). The checkboxes serve a different purpose in the subroutines below but once selected I wantto assign a Module level variable call "Model" to them respectively.

I have another checkbox {check227, see below] that designated whether the configuration is a shallow pit design. Each particular model has a different cost associated with shallow pit so I wanted to use a Select Case statement based upon the Model.

If the checkbox is not checked then I just want to End the subroutine or do nothing. If it is checked, then based upon the Model do a Select Case.

I am really stretching my primitive programming skills here, but I'm pretty sure Select Case is faster than my typing out dozens of If-Then-Else statements.

## Data analysis: Querying a Database

To query the records of a database, you can use Boolean algebra combined with some operators. Boolean Algebra works on logical statements. A statement is a sentence that acknowledges a fact or a possibility. That fact is eventually evaluated as being true or false.

## Use Select Case to Consolidate Switch Function

I need to consolidate 5 fields stored in a table into 29 different categories (eventually to be used in a cross-tab query to generate counts of each category). I'm limited in using switch and/ or iif statements because of the number of nested statements I would need.

Is there a way to do this using by creating a function and using select case? I'm not sure how to reference multiple fields in a table.
Here is an example of what I was originally thinking of...