Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.
-
Upload
simon-davidson -
Category
Documents
-
view
225 -
download
0
Transcript of Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.
![Page 1: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/1.jpg)
Microsoft Access
Creating Queries
Expression Exercise- Criteria and Calculated Fields
![Page 2: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/2.jpg)
Using Northwind.accdb
Orders Table
![Page 3: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/3.jpg)
PgP MIS 202 Access Overview 2-3
1. Create Expression
Locate all Ship Names that contain a “q” anywhere in the name field
![Page 4: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/4.jpg)
PgP MIS 202 Access Overview 2-4
Criteria
Like "*q*"
![Page 5: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/5.jpg)
PgP MIS 202 Access Overview 2-5
2. Create Expression
Locate all Ship Postal Codes beginning with 050
![Page 6: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/6.jpg)
PgP MIS 202 Access Overview 2-6
Criteria
Like “050*”
![Page 7: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/7.jpg)
PgP MIS 202 Access Overview 2-7
3. Create Expression
Locate all Freight charges over $100.00, sort results in Descending Order
![Page 8: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/8.jpg)
PgP MIS 202 Access Overview 2-8
Criteria
>100
![Page 9: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/9.jpg)
PgP MIS 202 Access Overview 2-9
4. Create Expression
Locate all orders Shipped between 9/1/96 and 9/30/96
Sort Ascending by Shipped Date
![Page 10: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/10.jpg)
PgP MIS 202 Access Overview 2-10
Criteria
Between #9/1/96# and #9/30/96#
![Page 11: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/11.jpg)
PgP MIS 202 Access Overview 2-11
5. Create Expression
Number of days before today an order shipped
Sort Descending
![Page 12: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/12.jpg)
PgP MIS 202 Access Overview 2-12
Calculated field
DaysSinceShip: Date()-[ShippedDate]
![Page 13: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/13.jpg)
Using Northwind.accdb
Order Details table
![Page 14: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/14.jpg)
PgP MIS 202 Access Overview 2-14
Create Expression
Locate all orders where Quantity is an odd number
Hint: search help (Find tab) for functions that contain the word “remainder”
![Page 15: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/15.jpg)
PgP MIS 202 Access Overview 2-15
Criteria
[Quantity] mod 2 <> 0
![Page 16: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/16.jpg)
PgP MIS 202 Access Overview 2-16
Create Calculated Field
Total discounted amount is greater than $1000.00
![Page 17: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/17.jpg)
PgP MIS 202 Access Overview 2-17
Calculated Field
Discounted Amount: UnitPrice * Quantity * Discount
With criteria: > 1000
![Page 18: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/18.jpg)
Using Northwind.mdb
Employees table
![Page 19: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/19.jpg)
PgP MIS 202 Access Overview 2-19
Create Calculated Field
Determine employee seniority
![Page 20: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/20.jpg)
PgP MIS 202 Access Overview 2-20
Calculated Field
Seniority: Date()-[hiredate] Or Years seniority: DateDiff("yyyy",
[hiredate],Date())
![Page 21: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/21.jpg)
Microsoft Access
Form and Report Basics
Delivering the data as required-tabular, graphical…
![Page 22: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/22.jpg)
PgP MIS 202 Access Overview 2-22
Forms
Used to maintain (add/delete/edit) the data in underlying tables
Finding data using Find dialog box Note available wildcard characters *, ?, [], !, -,#
Wizards-show typical layouts AutoFormat, to try different layouts quickly
![Page 23: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/23.jpg)
PgP MIS 202 Access Overview 2-23
Wildcard Characters
![Page 24: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/24.jpg)
PgP MIS 202 Access Overview 2-24
Forms and SubForms
Use to show data from related tables Tables have one to many relationship Example, View the many orders for one
customer Display lot of data in a small space
![Page 25: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/25.jpg)
PgP MIS 202 Access Overview 2-25
Forms and SubForms
Main form can have any number of subforms if you place each subform on the main form.
Can nest up to ten levels of subforms. Could have a main form that displays customers, a subform that displays orders, and another subform that displays order details
![Page 26: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/26.jpg)
PgP MIS 202 Access Overview 2-26
Form/SubForms Example
Open Northwind.accdb, Forms, ‘Customer Orders’
![Page 27: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/27.jpg)
PgP MIS 202 Access Overview 2-27
Form/SubForms Example
Form contains Customers table fields: CompanyName Country
This form is linked to subForm ‘Customer Orders Subform1’
![Page 28: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/28.jpg)
PgP MIS 202 Access Overview 2-28
Form/SubForms Example
Subform1 contains Orders table fields: OrderID RequiredDate
This subform is linked to subForm ‘Customer Orders Subform2’
![Page 29: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/29.jpg)
PgP MIS 202 Access Overview 2-29
Form/SubForms Example
Subform2 contains OrderDetailsExtended query fields: ProductName UnitPrice Quantity Discount Extended Price (a calculated field)
Note-this query is based on the tables ‘Order Details’ and ‘Products’
![Page 30: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/30.jpg)
PgP MIS 202 Access Overview 2-30
Form/Subform Relationships
![Page 31: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/31.jpg)
PgP MIS 202 Access Overview 2-31
Reports
Typically destined for printed output Can be based on table(s) or query or SQL
statement Report Wizard can do most of the work For the finishing touches modify in Design
View
![Page 32: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/32.jpg)
PgP MIS 202 Access Overview 2-32
Reports and Forms- Design View
Wizards can do most of the work, but to tailor forms/reports to what you want, you must understand how to modify them in Design View
Examine property settings-similar to Visual Basic forms and controls
![Page 33: Microsoft Access Creating Queries Expression Exercise- Criteria and Calculated Fields.](https://reader035.fdocuments.us/reader035/viewer/2022062217/5697bff61a28abf838cbdfb3/html5/thumbnails/33.jpg)
PgP MIS 202 Access Overview 2-33
Report and Form Graphics
Graphics can improve appearance, but Possible performance penalty due to way
Access stores graphic images Be aware of “Image” object “SizeMode”
property settings of clip, stretch, zoom