1 / 10

Access and Condition Statements

Access and Condition Statements. Please use speaker notes for additional information!. I am asking for all records where the major = “CI”. Note that this can be written as =“CI” but Access decides you do not need the = and eliminates it. Essentially equal is the default.

abril
Download Presentation

Access and Condition Statements

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Access and Condition Statements Please use speaker notes for additional information!

  2. I am asking for all records where the major = “CI”. Note that this can be written as =“CI” but Access decides you do not need the = and eliminates it. Essentially equal is the default.

  3. Problem: I want to display the record for all students that have a major = “CI”, a state = “MA” and credits > 15. Logic flowchart: Pseudocode: if major = “CI” then if state = “MA” then if credits > 15 then display record endif endif endif major=“CI” No Yes state=“MA” No Yes credits > 15 No Yes Display in list

  4. Problem: I want to display the record for all students that have a major = “CI” or a major of “BU”. major=“CI” No Yes Pseudocode: if major = “CI” then display record else if major = “BU” then display record endif endif Display in list major=“BU” No Yes Display in list

  5. In this example I want major to be either “CI” OR “BI”. Notice that I have the first thing under criteria and the second under OR.

  6. Problem: I want to display the record for all students that have a major = “CI”AND either the gpa is greater than 3.5 or the credits is > 30. Flowchart: Pseudocode: if major = “CI” then if gpa > 3.5 then display record else if credits > 30 then display record endif endif endif major=“CI” No Yes gpa > 3.5 No Yes credits > 30 Display in list Yes No Display in list If major is = to “CI” then I can continue and ask the other questions. If major is not = “CI” then I am done. Once I have established that major is equal to “CI” then I have a standard OR where I am asking whether the gpa > 3.5 OR credits > 30. The structure is that the first question needs to be true and then either of the remaining questions have to be true.

  7. Access requires that you repeat the “CI” on both lines. Essentially, Access makes you ask the question as is major = “CI” and gpa > 3.5 OR is major = “CI” and credits > 30. This is because of the limitations of the user friendly query in Access. In many languages this would be written as: if major=“CI” and (gpa > 3.5 or credits > 30) As you will see, logic dictates that ANDs get resolved before ORs. This means that things around the AND get processed together. In this example, I want the OR to group two things together. I can change the order of operations by using the parenthesis to group the OR conditions so it read major = “CI” and either of the other conditions.

More Related