Separate speaker notes to accompany AccessIF:

 

Slide #1:

This presentation will deal with conditional statements in Access.  We will deal with complex conditions involving AND and OR.

Slide #2:

This shows the data that I have in the table called tablestu. The structure is on the next slide.

Slide #3:

This is the structure of the data.  Notice that only gpa and credits are numbers.  The gpa is single to allow for decimal places and the credits is an integer.

Note also that the key is idno.

Slide #4:

This shows the simple query of asking for all CI majors.

There are 14 records in the table.  Seven of these records have the major CI.  As a result of this query, those records are shown.

Slide #5:

This shows a problem, the logic flowchart showing the solution and the pseudocode showing the logic to solve the problem.  The solution in Access is shown on the next slide.  This is the AND structure.  In this example there are three things that must be true, it could have been two or four etc.

Slide #6:

This shows asking for all records where major = "CI" and state = "MA" and credits is > 15.  Note that CI and MA are in quotes because they are text.  15 is a numeric so it is not in quotes.

Slide #7:

This shows the problem, the logic flowchart and the pseudocode for a simple OR structure.  One or the other of these has to be true.  It does not matter which is true.  The Access for this query is shown on the next slide.

Slide #8:

Only one record does not meet the criteria - 13 out of the 14 records are either CI or BU majors.  Note that when I want an AND relationship the criteria are on the same line.  When I want an OR relationship the criteria are on different lines.

Slide #9:

This shows the flowchart and pseudocode for a structure that uses both AND and OR.

Slide #10:

This shows the results.  Notice that all people have CI and that two of them are there because the gpa is greater than 3.5 and one of them is there because credits is greater than 30.

Note that Access does provide a more extended way to do queries using SQL.