ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

25
ACCESS 3

description

CALCULATIONS IN QUERY Queries can be built to perform a calculation as part of the query We often do this for things that we do not need to store and take up space with Expressions can be entered into the query design grid as if they were regular fields Done on Numeric data type fields

Transcript of ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

Page 1: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

ACCESS 3

Page 2: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

OBJECTIVES

• Calculated fields in query design• Total option in query design• Creating Forms

Page 3: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

CALCULATIONS IN QUERY• Queries can be built to perform a

calculation as part of the query• We often do this for things that we do not

need to store and take up space with• Expressions can be entered into the query

design grid as if they were regular fields• Done on Numeric data type fields

Page 4: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

• To perform a calculation in a query, you must add a calculated field to the query design.

• Make certain that you are following the rules of precedence !

• Two options for entering expressions: – Enter the expression directly into the field text

box– Enter the expression in the Expression

Builder

Page 5: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

CREATING A CALCULATED FIELD USING BUILDERRemove the existing criteria In design view, click in the place where

you want calculated field.Then click the magic wand “Builder” icon

above. The expression builder shows up…

Page 6: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

THE EXPRESSION BUILDER…

Page 7: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

REMEMBER THIS…

• Note: If you see <<expr>> be sure to remove it ! ! !

• Expand the width of the column if you see ####…

Page 8: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

EXAMPLE

• In Design View of Query2 let us create a calculated field to show employment percent

EmpRate\(EmpRate+UnEmpRate)

Page 9: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

GET APPROPRIATE FIELDS IN TO BUILDER

Page 10: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

FORMAT

• Format the calculated field as Fixed number with 4 decimal places

• Execute the query

Page 11: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

SORT

• Sort GDP in ascending order

Page 12: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

EXAMPLE 2

• Download Baseball_Statistics file

Page 13: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

QUERY• Create a query to display League name

and Team name

Page 14: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

NOTICE REPETITIONS

Page 15: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

GROUP BY USING TOTALS

Page 16: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

SELECT THE APPROPRIATE GROUP BY OPTION

• Group by Leagues and number of teams

Page 17: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

NOTICE THE QUERY RESULT

Page 18: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

OTHER GROUP BY OPTIONS

• Average• Sum• Minimum• Maximum

Page 19: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

CREATE A FORM WITH SUBFORM

The main form should display the name of each league and division in the Divisions table

Page 20: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

SELECT FIELD FOR MAIN FORM

Page 21: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

SELECT FIELDS FOR SUBFORM

The subform should display the individual team names, the percent of games won, and whether they participated in a playoff game

Page 22: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

NOTICE FROM WITH SUBFORM(S)

Page 23: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

DATASHEET LAYOUT

Page 24: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.

TITLES

• Main form as League Results • Subform as League Results Subform

Page 25: ACCESS 3. OBJECTIVES Calculated fields in query design Total option in query design Creating Forms.