shelly cashman: microsoftaccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •to use text data in...

31
1 Shelly Cashman: Microsoft Access 2016 Module 2: Querying a Database © 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.

Upload: others

Post on 31-Mar-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

1

ShellyCashman:Microsoft Access2016Module2:QueryingaDatabase

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 2: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

2

• CreatequeriesusingDesignview

• Includefieldsinthedesigngrid

• Usetextandnumericdataincriteria

• Saveaqueryandusethesavedquery

• Createanduseparameterqueries

• Usecompoundcriteriainqueries

• Sortdatainqueries

Objectives (Slide1of2)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 3: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

3

• Jointablesinqueries

• Createareportandaformfromaquery

• Exportdatafromaquerytoanotherapplication

• Performcalculationsandcalculatestatisticsinqueries

• Createcrosstabqueries

• CustomizetheNavigationPane

Objectives (Slide2of2)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 4: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

4

• Roadmap• CreatequeriesinDesignview• Usecriteriainqueries• Sortdatainqueries• Jointablesinqueries• Exportqueryresults• Performcalculationsinqueries• Createacrosstabquery• CustomizetheNavigationPane

Project-QueryingaDatabase

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 5: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

5

• ToCreateaQueryinDesignView• Clickthe‘ShutterBarOpen/CloseButton’toclosetheNavigationPane• ClickCREATEontheribbontodisplaytheCREATEtab• ClicktheQueryDesignbuttontocreateanewquery• Clickthetabletoaddtothequery• ClicktheAddbuttontoaddtheselectedtabletothequery• ClicktheClosebuttontoremovethedialogboxfromthescreen• Dragtheloweredgeofthefieldlistdownfarenoughsoallfieldsinthetableappear

CreatingQueries (Slide1of10)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 6: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

6

CreatingQueries (Slide2of10)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 7: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

7

• ToAddFieldstotheDesignGrid• Double-clickeachfieldtoaddtothequery

CreatingQueries (Slide3of10)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 8: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

8

• ToUseTextDatainaCriterion• ClicktheCriteriarowforthefieldtoproduceaninsertionpoint• Typethecriterion• ClicktheRunbuttontorunthequery• ClicktheSavebuttonontheQuickAccessToolbartodisplaytheSaveAsdialogbox• Typethenameofthequery• ClicktheOKbutton(SaveAsdialogbox)tosavethequery

CreatingQueries (Slide4of10)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 9: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

9

• ToUseaWildcard• Ifnecessary,clicktheCriteriarowbelowthedesiredfieldtoproduceaninsertionpoint• Ifnecessary,deletethecurrententry• Typethecriterioncontainingthewildcardcharacter(*)

CreatingQueries (Slide5of10)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 10: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

10

• ToUseCriteriaforaFieldNotIncludedintheResults• Withthedesiredqueryopen,clicktheShowcheckboxtoremovethecheckmarkforafieldcontainingcriteria

CreatingQueries (Slide6of10)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 11: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

11

• ToCreateandViewaParameterQuery• Ifnecessary,returntoDesignviewandtypethecriterionforaparameterquery([EnterCity],forexample)• Runthequery

CreatingQueries (Slide7of10)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 12: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

12

• ToUseaNumberinaCriterion• ClicktheQueryDesignbuttontocreateanewquery• Clickthetableyouwishtoaddtothequery• ClicktheAddbuttontoaddtheselectedtabletothequery• ClicktheClosebuttontoremovethedialogboxfromthescreen• Addthedesiredfieldstothequery• Addanumericcriterionforanumericfield

CreatingQueries (Slide8of10)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 13: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

13

• ToUseaComparisonOperatorinaCriterion• OpenthequeryinDesignview• Enterthecriterionwithacomparisonoperator

CreatingQueries (Slide9of10)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 14: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

14

• ToUseaCompoundCriterionInvolvingAND• OpenthequeryinDesignview• AddthecriteriafortwofieldsintheCriteriarow

• ToUseaCompoundCriterionInvolvingOR• OpenthequeryinDesignview• AddcriterionforonefieldtotheCriteriarow• Addcriterionforanotherfieldintheorrow(therowbelowtheCriteriarow)

CreatingQueries (Slide10of10)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 15: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

15

• ToCleartheDesignGrid• OpenthequeryinDesignview• Clickjustabovethecolumnheadinginthefirstcolumninthegridtoselectthecolumn• HoldtheSHIFTkeydownandclickjustabovethelastcolumnheadingtoselectallthecolumns• PresstheDELETEkeytoclearthedesigngrid

Sorting (Slide1of4)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 16: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

16

• ToSortDatainaQuery• OpenthequeryinDesignview• ClicktheSortrowbelowthefieldyouwishtosort,andthenclicktheSortrowarrowtodisplayamenuofpossiblesortorders• Clickthedesiredsortorder

Sorting (Slide2of4)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 17: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

17

• ToOmitDuplicates• OpenthequeryinDesignview• Clickanemptyfieldinthedesigngrid• ClickthePropertySheetbuttontodisplaythepropertysheet• ClicktheUniqueValuespropertybox,andthenclickthearrowthatappearstoproducealistofavailablechoices• ClickYesandthenclosetheQueryPropertiespropertysheetbyclickingthePropertySheetbuttonasecondtime

Sorting (Slide3of4)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 18: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

18

• ToSortonMultipleKeys• OpenthequeryinDesignview• SelectasortorderintheSortcolumnformultiplefields

• ToCreateaTop-ValuesQuery• OpenthequeryinDesignview• ClicktheReturnarrowtodisplaytheReturnmenu• Clickanoptioncorrespondingtothevaluesyouwishtoreturn

Sorting (Slide4of4)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 19: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

19

• ToJoinTables• ClicktheQueryDesignbuttontocreateanewquery• Addtworelatedtablestothenewquery• Addthedesiredfieldsfromeachtabletothequery

• ToChangeJoinProperties• OpenthequeryinDesignview• Right-clickthejoinlinetoproduceashortcutmenu• ClickJoinPropertiesontheshortcutmenutodisplaytheJoinPropertiesdialogbox

JoiningTables (Slide1of2)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 20: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

20

• ToCreateaReportfromaQuery• OpentheNavigationPane,andthenselectthedesiredqueryintheNavigationPane• ClicktheReportWizardbuttontodisplaytheReportWizarddialogbox• Addthedesiredfieldstothequery• Followtheremainingstepsinthewizardtospecifyagrouping,sortorder,layoutandorientation,andtitle• ClicktheFinishbuttontoproducethereport

JoiningTables (Slide2of2)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 21: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

21

• ToCreateaFormforaQuery• SelectthequeryintheNavigationPane• ClicktheFormbutton tocreateasimpleform

CreatingaFormforaQuery

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 22: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

22

• ToExportDatatoExcel• ClickthedesiredqueryintheNavigationPanetoselectit• ClicktheExcelbuttontodisplaytheExport- ExcelSpreadsheetdialogbox• ClicktheBrowsebutton(Export- ExcelSpreadsheetdialogbox)todisplaytheFileSavedialogbox• Navigatetothelocationtosavetheexportedfile• ClicktheOKbutton(Export- ExcelSpreadsheetdialogbox)toexportthedata• Clickthe‘Saveexportsteps’checkbox(Export- ExcelSpreadsheetdialogbox)todisplaytheSaveExportStepsoptions• TypethedesirednameforthestepsintheSaveastextbox• Ifnecessary,typeadescriptionfortheexportsteps• ClicktheSaveExportbutton(Export- ExcelSpreadsheetdialogbox)tosavetheexportsteps

ExportingDataFromAccesstoOtherApplications

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 23: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

23

• ToRestricttheRecordsinaJoin• Openthequerycontainingajoin• Typethecriterionforthedesiredfield

AddingCriteriatoaJoinQuery

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 24: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

24

• ToUseaCalculatedFieldinaQuery• OpenthequeryinDesignviewcontainingafieldthatcanbecalculated• Right-clicktheFieldrowinthefirstopencolumninthedesigngridtodisplayashortcutmenu• ClickZoomontheshortcutmenutodisplaytheZoomdialogbox• TypethecalculationintheZoomdialogbox• ClicktheOKbutton(Zoomdialogbox)toentertheexpression

Calculations (Slide1of5)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 25: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

25

• ToChangeaCaption• OpenthequeryinDesignview• Clickthefieldinthedesigngridtowhichyouwishtoaddthecaption,andthenclickthePropertySheetbuttontodisplaythepropertiesforthefield• ClicktheCaptionbox,andthentypethedesiredcaption• ClosethepropertysheetbyclickingthepropertySheetbuttonasecondtime

Calculations (Slide2of5)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 26: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

26

• ToCalculateStatistics• Createanewqueryforatablecontainingfieldsforwhichyoucancalculatestatistics• ClicktheTotalsbuttontoincludetheTotalrowinthedesigngrid• Addthefieldforwhichyouwishtototal• ClicktheTotalrowfortheaddedfield• ClicktheTotalarrowtodisplaytheTotallist• SelectthedesiredcalculationforAccesstoperform

Calculations (Slide3of5)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 27: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

27

• ToUseCriteriainCalculatingStatistics• Addafieldtothequerycontainingstatisticsforwhichyouwishtoaddcriteria• ClicktheTotalrowinthedesiredcolumn• ClicktheTotalarrowfortheaddedfieldtoproduceaTotallist• ClickWhere• TypethecriterionintheCriteriarow

Calculations (Slide4of5)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 28: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

28

Calculations (Slide5of5)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

• ToUseGrouping

Page 29: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

29

CrosstabQueries (Slide1of2)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 30: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

30

• ToCreateaCrosstabQuery• ClicktheQueryWizardbuttontodisplaytheNewQuerydialogbox• ClickCrosstabQueryWizard(NewQuerydialogbox)• ClicktheOKbuttontodisplaytheCrosstabQueryWizarddialogbox• Followtheinstructionsinthewizardtoselecttherowandcolumnheadingsforthequery,andthennamethequery

CrosstabQueries (Slide2of2)

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.

Page 31: Shelly Cashman: MicrosoftAccess 2016 - toddiwema.com · 2019. 11. 27. · 8 •To Use Text Data in a Criterion •Click the Criteria row for the field to produce an insertion point

31

• ToCustomizetheNavigationPane• Ifnecessary,clicktheShutterBarOpen/CloseButtontoopentheNavigationPane• ClicktheNavigation PanearrowtoproducetheNavigationPanemenu• ClickthedesiredoptiontoorganizetheNavigationPane

CustomizingtheNavigationPane

©2017CengageLearning.AllRightsReserved.Maynotbecopied,scanned,orduplicated,inwholeorinpart,exceptforuseaspermittedinalicensedistributedwithacertainproductorserviceorotherwiseonapassword-protectedwebsiteforclassroomuse.