Access – combining data Types of operators : There are four types of operators that can be used in expressions:
Comparison operators : Comparison operators are usually used on numeric or date fields, but can also be used on text fields:
greater than = greater than or equal to < less than <= less than or equal to = is equal to <> is not equal to
arithmetic operators : Arithmetic operators perform math operations:
for addition – for subtraction – (unary) changes a negative number to a positive number multiplies two numbers / divides numbers \ divides the first value by the second value and rounds to the nearest integer ∧ raises to the exponent value of the second number miscellaneous operators Miscellaneous operators include Like, Between … And, In, and Is Null. The Like operator can be used with literals and the two wildcards in Access. The question mark (?) stands for one character; the asterisk () stands for a group of characters:*
Like “He?d” could find Head, herd, etc. Like “T?” could find To, ta, etc. Like “T” finds any word beginning with T. Like “fore” will find forehead, before, or any word that contains the letters “fore”. Like “1//2011” finds any date in January, 2011. Like “text here” is the equivalent to begins with “text here” is an exact match
Logical operators Logical operators combine or modify True/False expressions:
And: Both expressions are true Or: At least one expression is true Not: Matches records when the expression is not true Xor: Matches records when only one of the expressions is true. Exclusive Or. Eqv: Matches records when both expressions are true, or when both expressions are false. Equivalence. Imp: Matches when the second expression is true or when expression 1 is true and expression 2 is false. Implication.
Operators and Loops The code can take more than one path in flowchart script as it behaves differently depending upon how the user interacts with the web page and/or the browser window itself from here comes the need to handle these paths programmers often rely upon the following three concepts:
EVALUATIONS You can analyze values in your scripts to determine whether or not they match expected results. DECISIONS Using the results of evaluations, you can decide which path your script should go down. The flowchart can help at making paths. For decision there are two components : a) An expression is evaluated, which returns a value b) A conditional statement says what to do in a given situation. LOOPS can execute a block of code several times… Different Kinds of Loops: A) for - loops through a block of code several times B) while - loops through a block of code while a specified condition is true. The syntax of a for loop : for ( init; condition; increment ) { statement(s); }
The syntax of the while loop : init. while (Condition) { statements ; update; }
USING IF … ELSE STATEMENTS:- An if … else statement allows you to provide two sets of code:
one set if the condition evaluates to true. another set if the condition is false the statements inside if a statement should be followed by a semicolon, but there is no need to place one after the closing curly brace of the code blocks. A switch statement:- A switch statement starts with a variable called the switch value. Each case indicates a possible value for this variable and the code that should run if the variable matches that value.
IF …ELSE & SWITCH:- IF … ELSE : There is no need to provide an else option. (You can just use an if statement.) • With a series of if statements, they are if all checked even a match has been found (so it performs more slowly than switch). SWITCH : You have a default option that is run if none of the cases match. • If a match is found, that code is run; then the break statement stops the rest of the switch statement running (providing better performance than multiple if statements).