You are on page 1of 163

Advanced

Training Manual

Access 2007
velsoft.com

MicrosoftOfficeAccess2007AdvancedCourseware
WrittenbyJohnLaska
PublishedbyVelsoftInteractiveInc.

CoursewareReleaseVersion3.0

20062008byVelsoftInternational,Inc.

NoticeofRights
Nopartofthispublicationmaybereproduced,transmitted,transcribed,storedinaretrievalsystem,ortranslatedintoanylanguageor
computerlanguage,inanyformorbyanymeans,electronic,mechanical,magnetic,optical,chemical,manual,orotherwise,withouttheprior
writtenpermissionofVelsoftInternational,Inc.exceptunderthetermsofacoursewaresitelicenseagreement.

TrademarkNotice
PowerPoint,Windows,Word,MicrosoftaretrademarksofMicrosoft,Inc.Throughoutthiscoursewaretitle,trademarknamesareused.Rather
thanjustputatrademarksymbolineachoccurrenceofatrademarkedname,westateweareusingthenamesonlyinaneditorialfashionand
tothebenefitofthetrademarkownerwithnointentionofinfringementofthetrademark.

NoticeofLiability
Theinformationinthiscoursewaretitleisdistributedonanasisbasis,withoutwarranty.Whileeveryprecautionhasbeentakeninthe
preparationofthiscourse,neithertheauthorsnorVelsoftInternational,Inc.shallhaveanyliabilitytoanypersonorentitywithrespecttoany
lossordamagecausedorallegedtobecauseddirectlyorindirectlybytheinstructionscontainedinthisbookorbythecomputersoftwareand
hardwareproductsdescribedinit.

Disclaimer
Wemakeasincereefforttoensuretheaccuracyofthematerialdescribedherein;however,VelsoftInternationalmakesnowarranty,
expressedorimplied,withrespecttothequality,correctness,reliability,accuracy,orfreedomfromerrorofthisdocumentortheproductsit
describes.Datausedinexamplesandsampledatafilesareintendedtobefictional.Anyresemblancetorealpersonsorcompaniesisentirely
coincidental.

Termsandconditions
Sampleversions:IftheversionofcoursewarethatyouareviewingismarkedasNOTFORTRAINING,SAMPLE,orsimilar,thenitismade
availableforcontentandstylereviewonlyandcannotbeusedinanypartofatrainingcourse.Sampleversionsmaybesharedbutcannotbe
resoldtoathirdparty.Forlicensedusers:ThisdocumentmayonlybeusedunderthetermsofthelicenseagreementfromVelsoft
International,Inc.Velsoftreservestherighttoalterthelicensingconditionsatanytime,withoutpriornotice.

VelsoftInternationalInc.
#2RendezvousRD
Worthing
ChristChurch
BarbadosBB15006

TABLEOFCONTENTS

Section 1: Advanced Data Management ....................................................................................... 1


Lesson 1.1: Referential Integrity ........................................................................................................... 2
Using the Relationships View and Tab ................................................................................................................2
Types of Relationships .........................................................................................................................................7
Establishing Referential Integrity ........................................................................................................................9
Enforcing Referential Integrity ............................................................................................................................9
Testing Referential Integrity ..............................................................................................................................10
Lesson 1.2: Table Relationships .......................................................................................................... 13
About Join Lines.................................................................................................................................................13
Normalizing Tables ............................................................................................................................................13
Using Cascade Delete and Cascade Update......................................................................................................23
Setting Fields for Indexing .................................................................................................................................26
Using the Index ..................................................................................................................................................27
Lesson 1.3: Switchboards..................................................................................................................... 28
Using a Switchboard vs. Using the Navigation Pane and Tab ..........................................................................29
Using the Switchboard Manager........................................................................................................................30
Creating a Switchboard .....................................................................................................................................31
Editing a Switchboard........................................................................................................................................32
Deleting a Switchboard......................................................................................................................................34
Lesson 1.4: Modal Dialog Boxes .......................................................................................................... 35
Creating a Modal Dialog Box............................................................................................................................35
Adding Controls .................................................................................................................................................37
Setting Properties...............................................................................................................................................41
Formatting your Dialog Box..............................................................................................................................43
Section 1: Review Questions ................................................................................................................ 45

Section 2: Advanced Form Tasks................................................................................................ 47


Lesson 2.1: Using Subforms................................................................................................................. 48
Creating a Subform............................................................................................................................................48
Modifying a Subform..........................................................................................................................................52
Working with a Subform.....................................................................................................................................53
Synchronizing Subform Data with a Main Form ...............................................................................................55
Displaying a Subform within a Main Form........................................................................................................56
Lesson 2.2: Advanced Form Tasks...................................................................................................... 57
Limiting User Access to a Form.........................................................................................................................57
Creating Check Boxes and Command Buttons...................................................................................................59
Creating Event Procedures ................................................................................................................................61
Customizing Error Messages .............................................................................................................................63
Lesson 2.3: Exporting Your Form ...................................................................................................... 66
Sending a Form via E-Mail................................................................................................................................66
Managing Replies ..............................................................................................................................................74
Exporting your Form to XML ............................................................................................................................76
Lesson 2.4: Using Outlook and SharePoint with Access ................................................................... 83
Creating an RSS Feed for Outlook.....................................................................................................................83
Importing Contacts from Outlook ......................................................................................................................84
Importing Contacts from a SharePoint Server...................................................................................................91
Moving your Database to a SharePoint Server..................................................................................................94
Publishing to a Web Server................................................................................................................................98

Section 2: Review Questions .............................................................................................................. 100

Section 3: Pivoting Data ............................................................................................................ 102


Lesson 3.1: Creating a PivotTable .................................................................................................... 103
About PivotTables ............................................................................................................................................103
Creating a PivotTable ......................................................................................................................................104
More about PivotTable Fields .........................................................................................................................108
Completing your PivotTable ............................................................................................................................111
Lesson 3.2: Creating a PivotChart .................................................................................................... 113
About PivotCharts............................................................................................................................................113
Creating a PivotChart......................................................................................................................................114
More about PivotChart Fields .........................................................................................................................117
Completing Your PivotChart............................................................................................................................118
Lesson 3.3: Using PivotTables and PivotCharts .............................................................................. 120
Using a PivotTable...........................................................................................................................................120
Using a PivotChart ..........................................................................................................................................124
Editing a PivotTable or a PivotChart ..............................................................................................................124
Common PivotTable and PivotChart Editing Commands................................................................................127
Creating a PivotTable and PivotChart from the Same Object.........................................................................131
Section 3: Review Questions .............................................................................................................. 134

Section 4: Access and Windows................................................................................................. 136


Lesson 4.1: Access and Windows ...................................................................................................... 137
Recovering Access............................................................................................................................................137
Starting Access on Windows Boot....................................................................................................................138
Using Office Diagnostics .................................................................................................................................140
Checking for Updates.......................................................................................................................................144
Lesson 4.2: Using the Access Viewer................................................................................................. 145
What is the Access Viewer?..............................................................................................................................145
Downloading the Viewer..................................................................................................................................145
Using the Viewer..............................................................................................................................................146
Lesson 4.3: An Introduction to SQL ................................................................................................. 150
What is SQL? ...................................................................................................................................................150
Parts of an SQL Statement ...............................................................................................................................150
SQL Keywords .................................................................................................................................................151
Adding Where Clauses .....................................................................................................................................154
Section 4: Review Questions .............................................................................................................. 155

Index ........................................................................................................................................... 157

Section1:AdvancedDataManagement

Inthissectionyouwilllearnhowto:
Identifyandusedifferenttypesoftablerelationships
Establishandusereferentialintegrity
Understandhowreferentialintegrityworkstokeepdataconsistent
Recognizewhydatabasenormalizationisimportant
NormalizeadatabasebydesignandtheTableAnalyzer
Understandwhenandwheretonormalizedatainatable
Create,edit,anduseaswitchboard
Createandeditamodaldialogbox

2006Velsoft.com

MicrosoftOfficeAccess2007Advanced

Lesson1.1:ReferentialIntegrity

WelcometotheAccess2007AdvancedCourseware!Thismanualwillcoversomeofthemore
advancedfunctionalityprovidedbyAccess2007.Wewillexpandonthetopicscoveredinthe
IntermediateCoursewareaswellascovernewmaterial.Wewillalsoexplorethefunctionality
betweenAccess2007andotherprograms,aswellastheMicrosoftWindowsoperatingsystem.

Inthislessonwewilllearnhowtotakebettercontrolofyourdataandmakethedatabasework
forus.Asthesayinggoes,aninchofplanningequalsamileofprogress.Wewillexplorehow
datainadatabaserelatestoeachotherandhowtostrengthenthosebondstomakeyour
databaseastreamlinedcollectionofinformation.

UsingtheRelationshipsViewandTab

Weknowthatadatabaseisnothingmorethanrelevantdatastoredtogetherinsomelogical
way.Fieldsofinformationarestoredtogetherinarecord,oneormorerecordsmakeatable,
andoneormoretablesmakeadatabase.However,itishowthesetablesrelatetoeachother
thatreallydefinesadatabase.Relationshipstransformtheseseparatelistsofdataintoasingle
workingunit.Letsexplorehowtoviewtherelationshipsthatexistinadatabase.

First,clicktheRelationshipscommandintheDatabaseToolstabtoviewtherelationshipsthat
existinadatabase:

Inthediagramabove,wecanseethedetailsofasimpledatabase.Thisdatabasecontainsthree
tables.TheVehiclestablecontainsvitalstatisticsaboutdifferentmakesandmodelsofvehicles.

MicrosoftOfficeAccess2007Advanced

TheManufacturerstablecontainscontactinfoforthedifferentvehiclemanufacturers,andthe
Countriestableliststhenationsthatproducethevehicles.Tworelationshipsexistinthis
database,oneconnectingthedataintheManufacturerstabletothevehiclesintheVehicles
table.AsimilarrelationshipalsoexistsbetweenCountriesandVehicles.Wewillexplorethe
natureofrelationshipslaterinthislesson.

Eachtablerepresentedinthisdiagramcanbemovedandresizedbyclickinganddraggingthe
titlebarorclickinganddraggingthesidesofthewindows.Itisnotnecessarytohaveevery
tableinthedatabasevisibleallthetime;ifyoudontneedtoseeaparticulartable,clickitstitle
barandpressDelete.UsetheShowTablecommand(describedbelow)tobringbackahidden
table.

TheRelationshipToolsDesigntabcontainscommandsrelevanttotheuseofthisRelationship
view:

EditRelationships

ClickthiscommandtoopentheEditRelationshipsdialogbox.Thedefault
viewoftheboxletsyouchoosefieldsfromatableorqueryinorderto
createasimplerelationshipbyhand:

Ifyoufirstselectarelationship(byclickingononeoftheblackjoinlines)
andthenclicktheEditRelationshipscommand,youwillseedetails
pertainingtoonlythatrelationship:

MicrosoftOfficeAccess2007Advanced

ClicktheCreateNewbuttontomakeacomplexrelationshipbyhand.If
yourdatabasehasbeenwelldesigned,Accesswillbeabletopickupthe
specificsofhowonetableofdatarelatestoanotherautomatically.One
ofthegreatthingsaboutAccessgraphicalinterfaceisthatyoucan
simplydraganddroponefieldontoarelatedone.Accesswillexamine
thedataandstructureofeachsideoftherelationshipandcreatethe
bond.
ClearLayout

Clickthistoclearthetablesandrelationshipscurrentlydisplayedonthe
screen.Thiswillnotaffectanydatainthedatabase.

Relationship
Report

Thiscommandisusedtocreateasimplyreportsuitableforprintingore
mailingthatdetailshowthetablesinyourcurrentdatabasearerelated:

YouhavetheoptiontoprintthereportorexportittoPDForXPSande
mailittoothersinyourorganization.Youcanalsosavethereportasyou

MicrosoftOfficeAccess2007Advanced

wouldanyotherreportforreferencelateron.
ShowTable

ThiscommandwillopentheShowTabledialogbox.

Ifyouhaveaddednewtablestoyourdatabaseorhavehiddenatableto
makesomespace,youcanusethiscommandtounhideatable.Atthe
topofthedialogboxtherearetabstoswitchbetweentablesand
queries.Rememberthatqueryresultsareessentiallytablesandcan
thuslyberepresentedintheRelationshipsview.
HideTable

ClickthetitlebarofanytableintheRelationshipviewandclickHide
Tabletoremoveitfromthelayout.

Direct
Relationships

Ifyouneedtoseehowaparticulartablerelatestoothersinthe
database,andthereseemstobeapiecemissing,selectthetablein
questionandclicktheDirectRelationshipscommand.Thiswilldisplayany
tablesthataredirectlyrelatedtothistable.Forexample,considerthe
followingtwotables:

MicrosoftOfficeAccess2007Advanced

TheCountriestableiscurrentlyselected(indicatedassuchbecausethe
primarykeyisselected).ClickingtheDirectRelationshipscommandwill
displayalltablesthatshareadirectlinkwiththistable:

AllRelationships

ClicktheAllRelationshipscommandtodisplayeverytableandrelationin
thedatabase.Becareful;sometimestherelationshipwindowcan
becomecrowdedinahurry,especiallyifyourdatabaseislargeinsize.

OneofthenicethingsabouttheRelationshipsviewisthatanychanges
youmaketothelayoutcanbesaved.Sometimesviewingthedatabasein
agraphicalwaywillhelpyouandothersbetterunderstandwhatis
happening.Rememberthataparticularrelationshiplayoutsnapshotcan
besavedbyusingtheRelationshipReportcommand.

Close

ThiswillclosetheRelationshipsview.Youcanchoosetosavethecurrent
layoutsothatthenexttimeyouviewtherelationshipstheywillremainin
thesamelayout.

MicrosoftOfficeAccess2007Advanced

TypesofRelationships

Databasesworkbecauseoftherelationshipsspecifiedduringtheconstructionphase.Having
largeamountsofdataisnotveryusefulunlessthedatasomehowrelatestoeachother.
Databasescancontainthreetypesofrelationships:OnetoOne,OnetoMany,andManyto
Many.

AOnetoOnerelationshipisonewhereeachrecordinonetablecorrespondstoonerecordin
anothertable.Forexample,imagineyouownacorporationandhaveanofficebuilding.Lets
sayyouhaveatablecontainingemployeedataandatablecontainingofficeorcubicledata.At
anyonetimeinyourcompany,oneemployeeisassignedtooneoffice.Therefore,eachrecord
intheEmployeetableandeachrecordintheCubicletablecontainatleastonepieceof
identicalinformation(suchasanEmployeeID).

AOnetoManyrelationshipisthemostcommontypeofrelationshipinadatabase.Keeping
withourofficebuildingdatabase,letssayyouhavedepartmentsinwhichdifferentemployees
work.Onedepartmentcanhavemanyemployees,whileeachemployeeworksinone
department.Therefore,therelationshipbetweenthetablesisOneToMany.Wehavealready
seenanexampleofaOnetoManyrelationship:

ThisdatabasecontainstwoOnetoManyrelationships.Eachmanufacturercanberelatedto
manyvehicles,whileeachvehicleismadebyonlyonemanufacturer.

AManytoManyrelationshipisoneofthemostcomplexrelationshipstounderstand.Assuch,
theyarenotoftenusedindatabasesbecausetheycauseconfusiononlargerdatabaseprojects.
However,wewillexploretheiruseandfunction.

Ifwecontinuewiththeofficebuildingexample,youknowthatyouhaveemployeesthatwork
indifferentdepartments.Letstakeyourdatabaseonestepfurtherandincludetheadditionof
aJobtable.Eachemployeecanbeassignednomorethantwojobsatatime,andeachjobmust
haveatleastthreeemployeesworkingonit.Therefore,eachemployeemayhavezero,one,or
twojobsassignedtothemwhileeachjobmusthaveatleastthreeEmployeeIDsonrecord.

MicrosoftOfficeAccess2007Advanced

Access2007featuresafullsampledatabaseaboutafictionalcompanycalledNorthwind
Traderswhichsellsavarietyoffoodproducts.Whenthedatabasewasbeingdesigned,the
Northwinddatabaseengineersknewthattwotableswouldbeneeded,ProductsandOrders.It
wouldbeobviousthatoneproductwouldbesoldmorethanonce,andeachorderwouldlikely
containmorethanoneproduct.Therefore,aManytoManyrelationshipwouldbeestablished.

However,thiscreatesaproblem.ImagineaddingtheProductIDtotheOrderstable.Tohave
morethanoneproductperorder,youneedtocreateanewrecordforeachproductsoldper
order.Thiscreatesalotofrepetitionofdataforeveryrowofthesameorder.Thisalsocreates
alotofconfusionifseveralpeopleareworkingonthesamedatabase.Thesameproblem
wouldariseifyouputtheOrderIDintotheProductstable.Youwouldhaverecordsupon
recordsstatingthatthesameproductwassoldmultipletimes.ThedesignersoftheNorthwind
databasehandledthisbycreatingathirdtablecalledOrderDetails.ThiscreatestwoOneto
ManyrelationshipsoutoftheManytoManyrelationship:

ThisisthesetupemployedbytheNorthwindsampledatabase.TheProductstablecontains
ordersaboutonlytheproducts.TheOrderstablecontainsonlythedetailsaboutwhoplaced
theorder.TheOrderDetailsactuallyholdsthebulkoftheorderdata.NoticehowtheOrder
Detailstabledoesnothaveaspecificsingleprimarykeyliketheothertwotablesdo.Neither
OrderIDnorProductIDcanbeusedasaprimarykeybecausetherewillalmostcertainlybe
duplicatesofeach.Therefore,bothOrderIDandProductIDtogetherconstituteaprimarykey.
Thiswouldeliminateanyduplicationbecausethedatabaseisnotsetupinsuchawayso
someonecanbuytenunitsofproduct11andthentwomoreunitsofproduct11;oneperson
wouldbecountedasbuyingtwelveunitsofproduct11.

TheremaybecomeatimewhereaManytoManyrelationshipmaybeneeded,butthe
majorityofthetimecreatingtwoOnetoManyrelationshipswillbesufficient.

MicrosoftOfficeAccess2007Advanced

EstablishingReferentialIntegrity

Weknowthatestablishingrelationshipsbetweendifferenttablesofdatainadatabasewill
makethewholeunitfunctiontogether.Butnowthattheserelationshipshavebeen
established,whathappenstoachild(ordependent)tableifthedatainaparenttablegets
deletedormodified?

ReferentialIntegrityisasetofrulesandconditionsthatmakesdataentryintodatabasessafer.
Youshouldtrytoenforcereferentialintegritywheneverpossible.Itinsuresthatallrelated
fieldsarevalidwhenconsideredtogetherinadatabase,andpreventsyoufromaccidentally
deletingrelateddata.Tomakereferentialintegritywork,thefollowingthreeconditionsmust
besatisfied:

Thematchingfieldfromtheparenttableisaprimarykeyorhasauniqueindex
Thefieldsintherelationshiphavethesamedatatype
Bothtablesarestoredinthesamedatabasefile

Whenthesethreeconditionsaresatisfied,thenyouwillbeabletofullyestablishreferential
integrity.

EnforcingReferentialIntegrity

Toenforcereferentialintegrity,youmustfirstcreatearelationshipormodifyanexisting
relationship.Theeasiestwaytocreateoneistodraganddroponefieldfromonetableonto
anotherinRelationshipsview.Ifeditinganexistingrelationship,rightclickonthejoinlineand
clickEditRelationship.EithermethodwillshowtheEditRelationshipsdialogbox.

MicrosoftOfficeAccess2007Advanced

10

AccesshasdeterminedthatthetypeofrelationshipisOnetoManyandstateswhichfieldor
fieldswereconsideredintherelationship.Toestablishintegrity,clicktheEnforceReferential
Integritycheckbox.

Doingsowillmakethetwocheckboxesbeneathitactive.CascadeUpdateRelatedFieldswill
makeanychangeintheparenttablefilterdownthroughallrelatedchildtables.(Forexample.if
youchangeyouraddress,yourmainbankaccountwillchangeandsubsequentlyallother
relatedfinancialdocumentswillalsobechanged.)Similarly,CascadeDeleteRelatedFieldswill
removeallinstancesofaparticularrecordfromtheparenttabledownthroughtherestofthe
relatedtables.

TestingReferentialIntegrity

Duetothenatureofreferentialintegrity,muchofthetestingyoucandoforreferential
integrityisinherentlybuiltintothetablesbeforereferentialintegritycanevenbeestablished!
Letsdemonstratebytryingtocreatearelationshipwithatablethatdoesnotmeetthe
requirementsofreferentialintegrity.

Inthediagrambelow,theOtherCountriestablecontainsthesamefieldnamesastheCountries
table.However,theCountryIDinthenewtableisaTextdatatype,notAutoNumber:

MicrosoftOfficeAccess2007Advanced

11

IfCountryIDisdraggedanddroppedontotheCountryIDfieldoftheVehiclestable,thesame
relationshipwindowwillappear.Youcanstillcheckoffthatyouwishtoapplyreferential
integritytotherelationship,howeverifyouclickCreateyouwillencounteranerrormessage:

Nowimagineyouwanttotryandcreateanotherrelationship.Ifyoutrytocreatearelationship
betweentwoseeminglyunrelatedfields(suchasCountries.CountryandVehicles.Model),you
needtofirstfillinwhichfieldsyouwantconsideredintherelationship:

MicrosoftOfficeAccess2007Advanced

12

However,clickingOKwillnotestablishtherelationshipbetweenCountries.Countryand
Vehicles.Modelbecausenocommonfieldsexistbetweenthesetwoparticularfields,despite
beingthesamedatatype.

Referentialintegrityisonlyonewaytohelpkeepyourdatasafefromincorrectvalues.Other
featuresbuiltintoAccessalsoprovidedefenseagainstimproperdataentryincludingadding
validationrules,defaultvalues,andchoosingthecorrectdatatype.Allofthevariousmethods
ofprotection,whenusedtogethercorrectly,willresultinaverystabledatabase.

MicrosoftOfficeAccess2007Advanced

13

Lesson1.2:TableRelationships

Inthislessonwewillexpandupontheprinciplestaughtinthepreviouslessonandwewill
discoveralittlebitmoreaboutthenatureofrelationships.

AboutJoinLines

InRelationshipsview,Accessprovidesagraphicalviewofthedatacontainedinadatabase.
Visualizationofdatainthiswaycanreallyhelpauserunderstandwhatisgoingon.Thejoin
linesrepresentarelationshipbetweenonefieldinatableandanother.

Dependingonthenatureofarelationship,youwillseesmallsymbolsaboveeachendofajoin
linetoshowwhatroleeachtableofdataplaysinregardstotheother.Forexample,aOneto
OnerelationshipinAccesswillappearasthefollowing:

InthelastStepByStepexercise,youestablishedtwoOnetoManyrelationships:

Thenumber1andtheinfinitysignoneachendoftheaboverelationshipssymbolizesthatone
fieldinonetablemayrelatetomanyfieldsinanothertable.

NormalizingTables

Databasedesigncansometimesseemlikeadauntingtask.Butaswithmostthingsinlife,even
themostcomplicatedprocedurecanbebrokendownintoanumberofsimplesteps.Sotoois
thenatureofdatabases.Onceyouhaveagoodideaofwhatyourdatabaseistocontain,you
canbegintoapplyalevelofnormalizationtothedatabase.

MicrosoftOfficeAccess2007Advanced

14

Databasenormalizationisessentiallyasequenceofstepsthatbreaksalargeandcomplicated
databaseintosmallerpieces.Doingsopreventslargeholesinthedataandhelpseliminatethe
possibilityoferrors.Followingthenormalizationrulesalsomakesupdatingandmodifyingthe
databasemucheasier.Forexample,pictureadesktopPCasasingleentity.Nowthinkofthe
individualpieces.YouhaveaPC,amonitor,akeyboard,mouse,printer,powerbar,andcables
connectingitalltogether.Ifyourmousebreaksandyouwanttohaveitrepaired,youwouldnt
bringtheentirePCasassembledtoarepairshop;youwouldsimplydetachthemousetohave
itfixed.Thesameprincipleistruewithdatabasenormalization.Itwouldbeimpracticaltohave
everybitofinformationinonemassivetable;instead,breakthetabledownintomanysmaller
tables,eachcontaininginformationrelevantdirectlytoitself.

Databasescanbemoldedintofivedifferentnormalforms,eachformmorespecificthanthe
last.Letsquicklyexplorethefirstthreelevelsofnormalization.Thevastmajorityofdatabases
youwilluseinAccesswillreachthelevelofThirdNormalFormbutlikelynotanyhigher.

FirstNormalForm

FirstNormalForm(1NF)statesthateveryiteminatablemustbe
onlyasingleitem.Forexample,considerthefollowingquestions:
Whatisyourfavoritecolor?
Whatfoodsdontyouliketoeat?

Thefirstquestionhasonlyoneanswer,whilethesecondcanhave
manyanswers.Adatabasein1NFwillcontainatablelikethe
following:

Name Color
Alice

Red

Bob

Green

Carl

Blue

Thistable,however,isnotin1NF:

Name WontEat

Alice

Chinesefood,Brusselssprouts

Bob

Eggs,hamburgers,lentils

Carl

Fish,tomatoes

MicrosoftOfficeAccess2007Advanced

15

SecondNormalForm

SecondNormalForm(2NF)statesthatatablemustbein1NF,and
thateveryfieldinarecordthatisnottheprimarykeyisdependent
onaprimarykey.Access2007triestocreatealltablesin2NFby
addinganIDfieldwithanAutoNumberdatatypetoeverytable.
Themajorityofdatabasesforsmallandmediumapplicationswillbe
in2NF.

ThirdNormalForm

ThirdNormalForm(3NF)statesthatallnonprimarykeyfieldsmust
bemutuallyindependent;thatis,everynonprimarykeyfield
shouldbeeithertheprimarykeyofsomeothertableoruniquein
itstable.Considerthefollowingtabledesignin2NF:

ProductID(primarykey)
SupplierName
SupplierAddress

TheSupplierNameandSupplierAddressdonotbelonginthetable
ifthedatabaseistobein3NF.Thecurrent2NFmeansthatthere
willlikelybemuchrepeateddataifasinglesuppliersellsmany
products.Therefore,asecondtablewillbecreatedwiththe
followingattributes:

SupplierID(primarykey)
SupplierName
SupplierAddress

Theabovetabledesigncontainsalluniquedata.Therefore,thefirst
tablewouldbecome:

ProductID(primarykey)
SupplierID(foreignkey)

MicrosoftOfficeAccess2007Advanced

16

Access2007featuresabuiltindatabaseperformancetoolthathelpsyouanalyzedataina
table.Thisfunctionalitywillhelpyoufindthebestdesignoftabletosuityourneeds.Consider
thefollowingtable,alreadyin2NF:

Thisisnotthebestdesignbecausethistablecontainsalotofdatathatisnotnecessaryand
repetitive;forexample,wecanseethattheSupplierNameandAddressarerepeatedforeach
supplymadebythesamecompany.Althoughnotnecessary,closethetableyouwantto
analyzeifitisopen.ThispreventstheWizardfromtakingextrastepstowhilerenamingcertain
tables.ClicktheAnalyzeTablecommandintheAnalyzesectionoftheDatabaseToolstab:

MicrosoftOfficeAccess2007Advanced

17

ThiswilllaunchtheTableAnalyzerWizard:

ThefirsttwopagesoftheWizardgothroughsomeofthecommonerrorsassociatedwith
databasesandhowitcanfixthem:

MicrosoftOfficeAccess2007Advanced

18

ThenextpageoftheWizardasksyoutochoosewhichtableinyourdatabasecontainspossible
duplicatevalues.ChoosethetabletoanalyzeandclickNext:

Inthenextstep,youcanchoosetolettheWizardperformitsanalysesonyourtableandmake
recommendationsonhowitthinksyoushouldmodifythechanges:

MicrosoftOfficeAccess2007Advanced

19

TheWizardwillanalyzewhatitfeelswillbethebestwaytodividetheSuppliestable.

Byexaminingthislayout,wecanseethattheWizardhassuccessfullydividedthetabletomeet
3NF.EachcleaningsupplyhasanIDandaname,aswellasalookupfieldthatreferencesthe
nexttable.Thenexttablecontainsauniqueprimarykey,theaddressfield,andalookupfieldto
thefinaltable.ThefinaltablecontainsauniqueprimarykeyandtheSuppliername.Itmay
seemlikeanextrasteptoincludethethirdtable;however,theWizardthoughtitpossiblethat
anumberofcompaniesmightresideatthesameaddress(suchasmanycompaniesworking
fromthesameofficebuilding).Therefore,eachaddresswasgivenpriorityoverthecompany
name.

MicrosoftOfficeAccess2007Advanced

20

ClickthetitlebarofatableandthenclicktheRenameTableicon(

)togiveitanewname:

MicrosoftOfficeAccess2007Advanced

21

ThenextstepallowsyoutofurthercustomizehowAccesswillusetheprimarykeysgenerated
bythisWizard:

MicrosoftOfficeAccess2007Advanced

22

ThefinalstepoftheWizardcancreateaqueryforyouthatwillselectallofthefieldsfromallof
thenewlycreatedtables.

Itwillalsorenametheold(analyzed)tableastablename_OLD.

MicrosoftOfficeAccess2007Advanced

23

UsingCascadeDeleteandCascadeUpdate

Intheprevioussectionwelearnedthatwhentwotablesfollowtherulesofreferentialintegrity,
thewholedesignofthedatabasebecomesamoresolidunit.Itactuallybecomesachallengeto
enterbaddataintothedatabase!

Whenarelationshipisestablished,youwillseetheEditRelationshipdialogappear.Beneath
thecheckboxtoEnforceReferentialIntegrity,youwillseetwomorecheckboxesmarkedas
CascadeUpdateRelatedFieldsandCascadeDeleteRelatedFields:

ShouldanythinghappentodataontheonesideofaOnetoManyrelationship,thechanges
willthuslybefiltereddownthroughtherestoftherelationshiphierarchy.ConsidertheVehicles
databaseforearlierinthissection:

Bothoftherelationshipsshownherehavehadreferentialintegrityenforced,aswellasthe
optionstocascadetheupdateanddeleteenabled.Ifweweretoremoveoneofthe
ManufacturersfromtheManufacturerstable,anyvehiclesassociatedwiththatparticular
ManufacturerIDwouldberemovedfromthetable.ConsidertheremovaloftheManufacturer
Ford,whichcontainstwovehiclesintheVehiclestable.

MicrosoftOfficeAccess2007Advanced

24

Ifyoudeletearecordfromatablewhichfollowsthecascaderules,youwillseethefollowing
warning:

ClickingYeswillremovetherecord(s)fromthecurrenttableaswellasanumberofother
recordsinthemanytableintheOnetoManyrelationship:

NoticeinthediagramabovethattherecordswiththeVehicleIDs5and6havebeenremoved.
ThenatureoftheAutoNumberdatatype(thedatatypeusedbyAccessfortheID)willnotre
usethosenumbersagaininthistable.Anynewvehicleswillbelistedas10,11,etc.

Cascadingupdatesworkinthesamemanner,exceptthatrecordsaremodifiedinsteadofbeing
removed.Thisisbestshownbyexample.First,letsplacealookupfieldontheManufacturerID
sothatthedatashowninthetableismoremeaningfulthansimplyanumber:

MicrosoftOfficeAccess2007Advanced

25

NowimaginethataManufacturerchangestheirnameandyouwanttoapplythechange
throughyourentiredatabase.Becausecascadingupdateswereenabledinthisdatabase
relationship,wecaneasilychangethenameofoneManufacturerandhavethenamechange
reflectedthroughoutallrelatedtablesinthedatabase:

MicrosoftOfficeAccess2007Advanced

26

SettingFieldsforIndexing

Anindexisdesignedtohelpspeedupasearch.Whenyoulookupsomethinginan
encyclopedia,andthesubjectstartswiththeletterQ,youarenotgoingtostartlookingatAin
theindexandbrowseuntilyoureachQ!YouwillstartatQbecauseyouknowthevalueisnotin
anyofthesixteenpreviousletters.Thesameprincipleappliestoadatabase.Toindexafield,
openatableinDesignview:

TheModelfieldinthediagramaboveisanordinarytextfieldandisnotindexbydefault.There
arethreeoptionswhenindexing:

No

Noindexingwillbeperformedonthisfield

Yes(DuplicatesOK)

Thedatabasewillallowformultiplerowsthathavethesamefield
value.

Yes(NoDuplicates)

Theoppositeoftheabovefeature;ifyouhaveseveralrowswith
thesamemake,onlythefirstrowinstancewillbeindexed.

MicrosoftOfficeAccess2007Advanced

27

Primarykeysarealwaysindexedwithnoduplicates.Theonlydatatypesyoucantindexare
MemosandHyperlinks.

UsingtheIndex

Whentalkingaboutindexesingeneral,thereisnospecificcommandthatusesanindex.Their
usehappensinthebackgroundofthedatabase.However,creatingindexescansometimesbea
trickysituation.Inthisfinalpartofthislesson,wewilldiscusswhen(andwhennot)touse
indexes.

Asstatedbefore,primarykeysarealwaysindexed.Ifadatabasehasbeenestablishedin3NF,
youmaywishtoputanindexontheforeignkey(s)inatable.InthecaseofourVehicles
database,youmayactuallywanttoplaceanindexontheModelfield,aslistedinthecombo
boxofthediagramabove.YouwouldselecttheYes(DuplicatesOK)optionbecauseseveral
manufacturersmaynametheirvehiclesthesamething.

SettingafieldtoYes(DuplicatesOK)willallowforseveralrowstohavethesamefielddata.If
youhaveseveralrowsthathavethesamemodelname,andhaveseveraldifferentmodelsin
yourdatabase,thisoptionmakesdatabaseupdatessloweryetmakessearchesfaster(inthe
caseofverylargedatabases,containingmillionsofrecords).

SettingafieldtoYes(NoDuplicates)workstheoppositeofabove.Databaseupdatesbecome
fasterbutsearchtimeforquerieswillincrease(inthecaseofverylargedatabases).

Settingonlyasingleindexonahugetableandsettingtenindexesonmanysmalltablesmay
enduphavingthesameperformancegains/losses.Whenandwhereyoushouldindexa
databaseissomethingthatwillcometoyouwithtimeandexperimentation.

MicrosoftOfficeAccess2007Advanced

28

Lesson1.3:Switchboards

Inthetelephonedaysofold,youcontactedanoperatorwhosatinfrontofaboardofknobs
andswitches.Youtoldtheoperatorwhoyouwantedtocall,andtheywouldmakethe
connectionstoreachyourdestination.UsingmodernInternetterms,switchboardsarelikea
homepagewhereyoustartworkingwiththedatabaseasauserratherthanadesigner.

IfyouhaveusedAccessinthepast,youmayhavebeenfamiliarwiththeuseofswitchboards,
particularlywithearlieriterationsoftheNorthwindsampledatabase.Aswitchboardisaspecial
typeofformthatisusedtocontrolenduseroperationsofadatabasesuchasrunningareport
withasingleclick.However,Access2007doesnotincludeasmuchswitchboardfunctionalityas
inpreviousversions.Theuseofswitchboardshasnotbeenentirelyreplaced;nowdatabase
designerscanmakeuseoftheNavigationPaneandotherfeaturestocreateamore
customizable(yeteasiertobuild)interfaceforuserstointeractwith.Thiswasdoneasaneffort
toavoidhavinglessexperienceddatabaseusersstrugglethroughcreatingcustomVisualBasic
forApplications(VBA)codeinordertotakefulladvantageofaswitchboard.

Inthislessonwewillexploreamorestreamlinedswitchboardinterfaceandlearnhowtomake
useofthenewfeaturesofAccess2007tonavigatethroughtheworkingsofadatabase.

MicrosoftOfficeAccess2007Advanced

29

UsingaSwitchboardvs.UsingtheNavigationPaneandTab

Theactualuseofswitchboardsiseasyjustpointtothecommandyouwanttouseandclickit,
asdemonstratedwithaswitchboardfromAccess2003:

OlderversionsofAccessmadeuseofadatabasewindow.Thiswasafreefloatingwindow
insideAccessthatcontainedalistingofallobjectsinthedatabaseaswellasthecommandsto
createnewobjects.Access2007hasdoneawaywiththeDatabasewindowandinsteadusesa
combinationoftheNavigationPaneandtheTab.Thiswasdoneforacoupleofreasons:

TheNavigationPaneisalwaysvisibleontheleftsideofthescreen(bydefault).Theold
Databasewindowwasatthemercyofhowevermanyotherobjectsyouhadopenedin
yourdatabaseandwouldoftengetburied.WiththeNavigationPane,youhaveaquick
listingofalldatabaseobjects.Youcanalsocreatecustomcategoriesandgroupsthat
youcanusetodisplaywhicheverobjectsyoulikeinside.
TheTabholdsallofthedatabasecommandinaneasytouse,categorizedview.The
additionofcontextualtabs,thatisspecialgroupsofcommandsthatappearonlywhen
viewingacertainobjectacertainway,makesfindingtherightcommandyouneed
easierthanthemenusystemofold.Onlythecommandsyoucanusearethecommands
youseeonthescreen.
Inadditiontotheremovalofthedatabasewindow,Access2007featurestabbed
navigationofthedifferentobjectsthatareopenedtoviewinyourdatabase:

MicrosoftOfficeAccess2007Advanced

30

YoucaneasilycyclethroughthetabsastheybecomeactiveatthetopoftheAccess
window.Thepileoffloatingwindowshasbeeneliminated.(ManymodernWeb
browsingprogramsalsomakeuseofthistabstructure.)

UsingtheSwitchboardManager

TheSwitchboardManagerislocatedintheDatabaseToolssectionoftheDatabaseToolstab:

TheSwitchboardManagercontainsastandardswitchboardthatyoucanchoosetomakethe
defaultforyourdatabase.Toolsarealsoincludedtocreateyourownswitchboardbytheuseof
theEditcommand:

MicrosoftOfficeAccess2007Advanced

31

CreatingaSwitchboard

ClicktheNewbuttonintheSwitchboardManagertocreateanewswitchboard.Youwillfirstbe
promptedtoenteraname:

ThenameofthenewswitchboardwillbelistedintheSwitchboardManager,soselectthenew
switchboardfromthelistandclickEdit.TheEditSwitchboardDialogboxwillappear:

Asthisisanewswitchboard,therearenoitemsalreadyinplace.ClicktheNewbutton:

Thisdialogletsyouadjustallofthenecessaryelementstoaswitchboardinordertomakeita
functioningunit.Wewilllearnabouteachofthesecommandsinthenextsection.

MicrosoftOfficeAccess2007Advanced

32

EditingaSwitchboard

ByusingtheEditcommandintheSwitchboardManageryoucancreateawidevarietyofsimple
pointandclickfunctionalityforuseinyourswitchboard.Thecommandsavailablefora
switchboardcanbefoundinthepulldownCommandmenu:

Letstakealookateachcommand.

GotoSwitchboard

Youcanmovebetweenoneswitchboardandanother.Selectthis
commandandthenselectthetargetswitchboardinthe
Switchboardcombobox:

OpenForminAddMode

ThiscommandwillopenatargetforminLayoutviewwithno
recordscurrentlydisplayed.Thisallowsyoutoaddnewrecordsto
theform.

OpenForminEditMode

ThiscommandwillopenatargetformalsoinLayoutview,only
thistimeyoucanseeallofthedataintheformatonce.This
allowsyoutoedittherecordsalreadydisplayedintheform.

OpenReport

ThiscommandwillopenaspecifiedreportinReportview.

DesignApplication

Thiscommandwillopentheswitchboardmanagerquicklyand
easilytoletsomeoneworkontheswitchboard(s)inyour
database.

MicrosoftOfficeAccess2007Advanced

33

ExitApplication

Clickingthiscommandintheswitchboardwillclosethecurrent
databasefileandreturntotheGettingStartedpageofAccess
2007.

RunMacro

Thiscommandwilllaunchthespecifiedmacrothatwascreated
foruseinthisdatabase.

RunCode

LiketheRunMacrocommand,thiscommandletsyouexecutea
specificfunctionorblockofVBAcodeyouhavedesignedand
includedinthedatabasefile.

Onceyouhaveaddedthecommandsyouwishtouseinyourswitchboard,switchtoDesign
viewandmodifytheswitchboardlayout,look,andfeelasyouwouldifyouwerecreatinga
formorreport:

MicrosoftOfficeAccess2007Advanced

34

DeletingaSwitchboard

Todeleteaswitchboardthatyounolongeruse,simplyopentheSwitchboardmanager,select
theswitchboardtodelete,andclicktheDeletebutton:

Becarefulwhendeletingaswitchboard;theoperationcannotbeundone.UsetheSaveAs
commandontheswitchboardformintheNavigationPanetocreateabackupcopyyoumay
wishtosavewiththedatabaseregardless.Theonlyconditionwhendeletingaswitchboardis
thattheonemarkedasdefaultcannotbedeleted.

MicrosoftOfficeAccess2007Advanced

35

Lesson1.4:ModalDialogBoxes

EverygraphicaloperatingsystemtodayfeaturesatypeofdialogboxthatcontainsaYes/Noor
OK/Cancelsetofbuttons.Thesepopupwindowsareaspecialkindofdialogboxthatmustbe
dealtwithbeforeausercandoanythingelse.Wehaveencounteredlotsofthesetypesof
dialogboxesalongtheway,suchastheEditSwitchboardItemdialogbox:

Thereareoptionsthatareavailabletochangeinthisdialogboxtomodifythepropertyofsome
externalobject;inthiscase,aswitchboard.However,whilethiswindowisopen,allother
commandsinAccessaredisableduntilthisdialogboxisdealtwith.Suchwindowsarecalled
modaldialogboxes.

CreatingaModalDialogBox

Tocreateamodaldialogbox,clicktheMoreFormscommandintheFormssectionofthe
Createtab.Then,selectModalDialog:

Anewblankmodaldialogbox(whichisaspecialtypeofform)willopeninDesignview.

MicrosoftOfficeAccess2007Advanced

36

YoucanseetheOKandCancelbuttonsprebuiltinthelowerrighthandcorner:

Nowyoucanaddanytypeofcontroltothedialogboxasyouwouldifyouwerecreatingaform
orreport.

MicrosoftOfficeAccess2007Advanced

37

AddingControls

Access2007featuresawiderangeofcommandsthatcanbeusedinamodaldialogbox,aswell
asformsandreports.YouwillfindthesecommandsontheFormToolsDesigntab.Manyof
thecommandsyoucanuseareverysimilartoonesusedinmostgraphicaloperatingsystems
likeMicrosoftWindows.Letsreviewwhateachtypeofcontroldoes:

Logo

Thelogocommandpromptsyouforanimagefiletouseinthe
FormHeadersectionoftheForm.Itwillalwaysbepresentatthe
beginningofthepage.

Title

ThiscommandaddsatitletotheFormHeadersection.

PageNumbers

ClickthiscommandtoshowthePageNumbersdialogbox.Select
theoptionsandpositionyouwanttouseforyourform.

MicrosoftOfficeAccess2007Advanced

38

DateandTime

ThiscommandshowstheDateandTimedialogbox.Itallows
youtoselecttheformattingoptionsyouwantforyourform:

TextBox

Label

Button

Clickthiscommandandthenclickanddraganareaonthe
canvastoaddthetextbox.Atextboxcanholdanytypeofdata
exceptgraphical.
Nearlyeverycontrolhasanassociatedlabel,onethattellsyou
whatthecommandiscalled.Clickanddraganareainthe
canvas.
Abuttonisusedtoperformsomesortofaction,liketheOKand
Cancelbuttonsofadialogbox.Clickanddragthesizeofbutton
youwant.

ComboBox

Youshouldbeveryfamiliarwiththefunctionofcomboboxesby
now.Usecomboboxestohavetheuserpickanoptionoutofa
listofoptionsbyclickingthepulldownarrow.

ListBox

Aboxthatworkssimilartoacombobox,butitcanbeexpanded
toshowallofitscontents.Ausersimplypickstheoptionoutof
thelisttheywanttouse.

Subform/
Subreport

Letsyoucreateaforminsideaformorareportinsideareport.

MicrosoftOfficeAccess2007Advanced

39

Line

Clickanddragtodrawalineintheform.Usefulfordividingup
theformcomponentsintogroupssotheyareeasiertoread.

Rectangle

Drawrectanglesintheformtohelpprovideavisualgroupof
relatedcomponents.

BoundObject
Frame

Allowsyoutoenterandcontrolvariousexpressionsandlow
leveloperationsthatcanbeperformedonthedatabase.

OptionGroup

Clickanddragaboxaroundagroupofcontrolstogroupthem
together.Usefulwhenusingradiobuttons;userscanselectone
optionoutofthegrouptoperformacertainaction.

CheckBox

Whenchecked,theconditionboundtothecheckboxistrueor
active.Whenunchecked,theconditionisfalseorinactive

Option(Radio)
Button

Usedtoselectacertainoption,andalmostalwaysingroupsof
twoormore.

ToggleButtons

Atogglebuttonscommandstaysineffectwhenclickedandwill
remainsountilitisclickedagain.

TabControl

Letsyoucreateaseriesoftabsinyourform,eachwithitsown
options.Usefulifyouhavealargenumbersofcontrolsina
framethatcanbecategorized.

InsertPage

Usethiscommandtoinsertapageintoacertainsectionofa
form.

InsertChart

ClickanddraganareaintheformtoopentheChartWizard.
ThisWizardwillanalyzethedatacontainedinaqueryorreport
anddisplaydataforyouinagraphicalway.

Unbound
ObjectFrame

Allowsyoutocreateaspecialwindowinsideaframethatyou
canusetoviewsomeotherdocumentwhilelookingatyour
form.Forexample,youcouldhaveasmallwindowcontaininga
PDFdocumentoraPowerPointpresentation.

Image

Allowsyoutoplaceapictureinyourform.

PageBreak

Usedtocreateacutoffpointwhenprintingadocument.Even
thoughyoumaybeabletoseeeverythingonyourscreen,a
newpagewillalwaysprintoffwhenapagebreakis
encountered.

MicrosoftOfficeAccess2007Advanced

40

Hyperlink

Attachment

Thiscommandwillcreatealinktoanotherfile,Webpage,or
resourceexternaltoyourdatabase.

Usethiscommandtoviewnonalphanumericdatacontainedin
yourdatabase.

LineThickness

Choosethethicknessofthelineyouhavecurrentlyselectedor
areabouttomake.

LineType

Choosealinepattern.

LineColor

Choosealinecolor.

SpecialEffect

Youcanapplyaspecialeffecttoabuttonorothercontrolto
makeitlooklikeitis3D,flat,orsunkenintotheform.

SetControl
Defaults

Usethiscommandtorevertacontrolspropertiesbacktothe
defaultsetting.

SelectAll

Usethiscommandtoselectallcontrolscontainedinaform.

Select

Thiscommandletsyouselectacontrolsoyoucanmoveit
aroundthecanvas.

UseControl
Wizards

TogglethiscommandtohaveAccessautomaticallystarta
Wizardtohelpwiththecreationofdifferentcommandsina
form.

ActiveX
Controls

ActiveXcontrolsarespecialtypesofcontrolsthatareusedto
enhancethefunctionalityofaform.Theycanbeusedassmall
toolbarsorapplicationsthatexecutefrominsideaform.

MicrosoftOfficeAccess2007Advanced

41

SettingProperties

Amodaldialogboxcontainsmanyofthesamepropertiesofformsandreports.Clickthe
PropertySheetcommandtoviewtheproperties:

UsethecomboboxinthePropertySheetpanetoselectwhichobjectyouwillbemodifying.
UsethetabsatthetopofthePropertySheettocyclethroughthecategoriesofproperties
availableforanyparticularobject.

MicrosoftOfficeAccess2007Advanced

42

Thefunctionalityofthemodaldialogboxreallycomesfromthecommandbuttonsatthe
bottomofthebox.ThepropertieslistedintheEventtabdictatewhatactionswillbeperformed
basedonhowthecommandisinteractedwith:

ClicktheExpressionBuildericontoopenaspecialversionofmacrodesigntools:

MicrosoftOfficeAccess2007Advanced

43

ChoosetheVBAcommand(s)youwishtousefromtheActioncombobox.AnyArgumentsthat
needtobeenteredinorderforthecommandtoworkproperlycanbeenteredintothe
Argumentscolumn.Also,ifateamofpeoplearegoingtobeworkingonthedialogboxandyou
wishtoshareinformationabouthowthecommandwillwork,enterthemintotheComment
column.

Thecommandslistedinthetabrelatetowhichcommands,macros,andconditionswillbeused
inthisdialogbox.TestyourbackgroundmacroatanytimebyclickingtheRuncommandinthe
upperlefthandcornerofthescreen.

FormattingyourDialogBox

OneofthecontextualtabsthatappearswhenaformisbeingworkedonistheArrangetab.
Thistabincludesthenecessarycommandstomodifythelayoutandpositionofthecontrols
featuresinthemodaldialog.

QuickFormat

TheAutoFormat
commandisusedto
quicklyapplyaparticular
designschemetoyour
entireform.AutoFormat
featurestwentyfive
differentpremade
formattingoptionstouse.

ControlLayout

ControlAlignment

ThissectionoftheLayout
taballowsyoutomodify
thepositionofthe
controlsinyourform.You
canmovecontrolsina
grouporindividually.
Thecommandsinthis
sectionareusedtoaligna
groupofcontrolstothe
overlayingdesigngridor
tothepositionofa
particularcontrolinthe
form.

MicrosoftOfficeAccess2007Advanced

44

Size

Position

Show/Hide

Ifyouhavedifficulty
aligningcontrolsbyhand
orwanttoaligncontrols
quicklyyetneatly,usethe
commandsintheSize
sectionoftheLayouttab.
Access2007givesthe
flexibilitytoarrangethe
orderandpositionof
differentcontrolsinyour
form.

Thesecommandsletyou
showorhidedifferent
featuresofDesignview
itselfsuchasthegridlines
andrulers.

MicrosoftOfficeAccess2007Advanced

45

Section1:ReviewQuestions

1.
A.
B.
C.
D.

ClickingtheDirectRelationshipscommand:
WillshowallManytoManyrelationshipssharedwiththehighlightedtable
Willshowallrelationshipssharedwiththehighlightedtable
WillshowalltheOneToManyrelationshipsinthedatabase
Noneoftheabove

TheVehiclestablecontainsbothVehicleIDandCountryID.CountryIDisbest
described,inthissituation,as:
A.
Aprimarykey
B.
Asecondarykey
C.
Aforeignkey
D.
Aremotekey

3.
Whichofthefollowingmustbesatisfiedinorderforreferentialintegritytowork
properly?
A.
Thematchingfieldfromtheparenttableisaprimarykeyorhasauniqueindex
B.
Thefieldsintherelationshiphavethesamedatatype
C.
Bothtablesarestoredinthesamedatabasefile
D.
Alloftheabovearenecessary

4.
Youhavethreefriends,Alice,Bob,andCarl.Youaremakingatableabouttheirlikes
anddislikes.Whichquestionwouldproduceinformationtomakeatablein1NF?
A.
Whatareyourfavoritefoods?
B.
Whatcitiesdoyouwanttovisit?
C.
Whichairlinedidyoulastflywith?
D.
Whatarethenamesofyourparents?

5.
WhatlevelofnormalizationdoestheTableAnalyzerattempttoreach?
A.
4NF
B.
3NF
C.
2NF
D.
1NF

6.
Cascade_________willchangeeachrelatedfieldinevery_______table.
A.
Update,child
B.
Update,parent
C.
Delete,parent
D.
Delete,child

2.

MicrosoftOfficeAccess2007Advanced

A.
B.
C.
D.

WhichcommandactivatestheIndexingfeatureforafield?
Ctrl+I
TheIndexedpropertyintableDesignview
TheIndexingcommandintheDatabaseToolstab
Noneoftheabove

A.
B.
C.
D.

Switchboardsareused:
Toquicklyviewdatainaquery
Toviewandenterdatainaform
ToopenaSharePointserver
Toviewaform,report,orotherswitchboardwithasingleclick

A.
B.
C.
D.

Whencreatingaswitchboard,theOpenForminEditModecommandwill:
Openaformtoviewallthedataatonce
Openaformtoviewasinglerecordatonce
Openaformtoeditthelayoutoftheform
Noneoftheabove

7.

8.

9.

Wheneditingthebackgroundcommandsforamodaldialogbox,youareessentially
editinga:
A.
Macro
B.
Form
C.
DataAccessPage
D.
Noneoftheabove

10.

46

MicrosoftOfficeAccess2007Advanced

Section2:AdvancedFormTasks

Inthissectionyouwilllearnhowto:
Createasubform
Useasubformtoexpandinformationinamainform
Limitusersfrommodifyingdatainaform
Createandmodifycommandbuttonsandcheckboxes
Createcustomizederrormessages
Sendaformviaemail
Storeandorganizerepliesfromanemailform
ImportcontactsfromMicrosoftOutlook
ImportandexportdatatoandfromaSharePointserver

47

MicrosoftOfficeAccess2007Advanced

48

Lesson2.1:UsingSubforms

Thepurposeofaformistoenteranddisplaydataisadatabaseonerecordatatime.Access
2007takestheuseofformsfurtherwiththeadditionofasplitform(aformthatcontainsa
datasheetviewofthesourcetableasdataisbeingentered)andasubform(whichisaform
insideaformthatincreasestheusabilityofaform).

AsubformallowsyoutofurthervisualizeaOnetoManyrelationship.Forexample,ifyouwere
creatingaformbasedontheProductstableintheNorthwindsampledatabase,youcancreate
asubformbasedontheOrderDetailstable.Thesubformcandisplaydatabasedonthecurrent
datainthemainform.Thatis,youcanlisthowmanytimesaparticularproduct(theoneside)
hasbeenordered(themanyside)bymakinguseofasubform.Wewilldiscusstheusageof
subformsinthislesson.

CreatingaSubform

TheNorthwindsampledatabasemakesuseofsubformstobetterdisplayinformationtothe
user.ConsidertheHomeformwhichopensafterauserlogsintothedatabase:

Thesubformaboveisalistingofproductsthathaveastocklevellessthanthelevelindicatedin
theReordercolumn.Thissubformisdisplayedinsideaspecialtypeofpictureframethat
containsthesubform.

MicrosoftOfficeAccess2007Advanced

49

Tocreateasubform,openaforminwhichyouwouldliketoputthesubform.Clickthe
Subform/SubreportcommandintheControlssectionoftheFormToolsDesigntab:

Clickanddraganareainsideyourformthatwillcontainthesubform:

Makeaguessastohowlargeyoursubformwillneedtobe,butrememberthatyoucanalways
clickanddrag(aswellasmove)thesubformareainDesignvieworLayoutviewtosuityour
needs.

MicrosoftOfficeAccess2007Advanced

50

TheFormWizardletsyoucreateaformandsubformatthesametime.Inordertodothisand
stilldisplaydatathatmakessense,keepinmindtheOnetoManyrelationshipyouwishto
show,suchastheProductsandOrderDetailstables.(Keepinmindthatyoumustestablishthe
relationshipsbetweenthedataifyoursubformisdesignedtoaddthefieldsfromeachtable
youwishtodisplayinyourform/subformcombination.)

InthenextstepoftheWizard,selectwhichtableorquerywillbethemainform;likethe
Productstable.MakesuretheFormwithsubform(s)radiobuttonisselected:

MicrosoftOfficeAccess2007Advanced

51

IntheremainingstepsoftheWizard,youcanchoosehowthesubformwilldisplaythedata,
whatsortofAutoFormatyouwouldliketoapply,andthennametheformandsubform:

MicrosoftOfficeAccess2007Advanced

52

ModifyingaSubform

Onceyouhavedefinedthesubformarea,orcreatedasubformviatheWizard,clickthe
PropertySheetcommandtoviewthepropertiesofthesubform.Ifyouarecreatingasubform
fromscratch,oneofthefirstpropertiesyoushouldmodifyiswhatdatasourcethesubformwill
bebasedupon.ClicktheDatatabandthentheSourceObjectcomboboxtoseetheavailable
objectsforuseinthesubform:

IfwewishtorecreatepartoftheHomeformfromtheNorthwindsampledatabase,selectthe
InventorytoReorderSubformforHomeformfromthelist.

MicrosoftOfficeAccess2007Advanced

53

SwitchtoeitherLayoutvieworFormviewtoseethesubform:

ThetabscontainedinthePropertySheetlistthecommandsavailableforusewiththesubform
object:

Format

Thistabcontainscommandsrelatingtohowthesubformwillbedisplayed.
Commandsincludewhenthesubformwillbedisplayed,whatmarginsarearound
thesubform,theborderwidthandcolorscheme,etc.

Data

Thistabspecifieswhichform/table/querywillbeusedtocreatethesubform,
allowsyoutolinkfieldsthatarecommonbetweentheChild(subform)and
Master(mainform)forms,andletsyoulockasubformsoitscontentscannotbe
modified.

Event

TheEventtaballowsyoutocreateasubroutineusingmacrosorVBAcodethat
willexecutewhenthesubformopens,closes,orboth.

Other

Thistabletsyoucreateanameforthesubform,inserttexttodisplayinthe
statusbar,andcontrolthetaborderoftheobjectsinthesubform.

WorkingwithaSubform

ThemajorityofsubformsyoucreatewillbeonthemanyendofaOnetoManyrelationship.
Thereistheoddtimewhere,forexample,youmaywanttolisttheshippersinasubformas
partoftheemployeelistingform,butsuchinstanceswillberare.

Subformsshouldbedevelopedwithaspecificpurposeinmind.Inthislessonweexploredthe
exampleofcreatingaProductsformwithanOrderDetailssubform.ThoughtheFormWizard
willhelpwiththesimpleformcreation,mostoftheadvancedoptionstomodifywithaform
willbetakencareofinDesignview.

MicrosoftOfficeAccess2007Advanced

54

IntheexampleoftheNorthwindsampledatabase,theInventorytoReordersubformforHome
indesignviewissimplythefollowing:

Thepropertiesofthesubformhavebeenmodifiedsuchthatthedatacontainedinthisformis
displayedinDatasheetviewinsteadoftheviewasabove.TheProductNamefieldhasbeen
turnedintoahyperlinksothatifaparticularproductnameisclicked,theProductDetailsform
willappearshowingthedetailsofthatparticularproduct:

Asubformcontainsallthefunctionalityofaregularform;thetermsubformisjustawayto
describethefactthatthereisoneforminsideanother.

MicrosoftOfficeAccess2007Advanced

55

SynchronizingSubformDatawithaMainForm

Wementionedbeforeinthislessonthatasubform/mainformrelationshipmakesthemost
senseifthesubformdataissomehowinaOnetoManyrelationshipwithdatainthemain
form.TheexampleweusedwastohaveaProductsmainformandanOrderDetailssubform.
Oneproducthastheabilitytobeorderedmorethanonce;thereforethesubformdatawill
containtheorderinghistoryofaparticularproduct.

Thisexamplepresentsanopportunitytosynchronizethesubformdatawiththemainform.
Perhapsyouwanttoaddanewproducttothedatabasebyusingaform.TheProductsmain
formwilllikelycontainallofthefieldsassociatedwiththeProductstable,oratleastenough
fieldstouniquelydefineaproductlikeProductID,Description,Price,etc.Oncethenew
producthasbeenenteredintothedatabase,anyneworderscontainingthatproductwillbe
automaticallyrelatedtotheProductrecordthatwillbedisplayedintheform.

Alinkbetweenamainformandsubformcanbecreatedbyusingthepropertysheet.Simply
assigntheLinkedChildandMasterfieldsusingtheDatatab:

Otherbackgroundcodeassociatedwithmorecomplexsynchronizationofsubformsandmain
formsisbeyondthescopeofthismanualbutcanbefoundintheDeveloperhelpfile.

MicrosoftOfficeAccess2007Advanced

56

DisplayingaSubformwithinaMainForm

YounowknowthateverythinginAccesshassomesetofpropertiesthatcanbemodified.
Subformsarenodifferent.Subformsareusuallycreatedtocatertoaspecificpurpose,yetyou
canstillmodifyhowthesubformdatawilllookbyusingtheFormattabinthePropertySheet:

Asubformistreatedlikeasinglecontrolinthemainform,thereforeadjustingthesesettingsis
justlikeadjustingthesettingsofacomboboxorcommandbutton.Youcanadjustthesize,
margins,gridformattingcommands,andlookofthesubformcomponentbyusingthese
settings.

MicrosoftOfficeAccess2007Advanced

57

Lesson2.2:AdvancedFormTasks

Atthispoint,youshouldbecomfortablewiththeuseoftheFormWizardandhowtouse
Designviewtocreatetheformsyouwanttouse.Inthislessonyouwilllearnhowtoimplement
moreoftheadvancedfunctionalityofforms.

LimitingUserAccesstoaForm

Themajorityofformsyouwillcreatewillbeusedtobothdisplayandenterdata.However,
theremaycomeatimethatyouonlywanttodisplaytheinformationandnotallowany
modificationoftheunderlyingdata.Accessallowsyoutodosoforbothformsandsubformsby
modifyingtheproperties.

YoucanmodifyhowauserwillbeabletouseaformusingtheDataPropertiestab:

Usethesepropertiestolocktheusabilityoftheform.Insomeinstances,youmaywantto
removemoreofthefeaturesthatmakeasubformlooklikeaformandthereforediscourage
peoplefromtryingtomodifyanydatacontainedintheform.Theseoptionsincludeshuttingoff
theScrollBars,RecordSelectors,andNavigationButtons(allfoundintheFormattabofthe
formPropertySheet).

MicrosoftOfficeAccess2007Advanced

58

Asyoumodifydifferentpropertiesofaform(oranydatabaseobject)youcanseeabrief
descriptionofthecommandintheStatusbaratthebottomoftheAccesswindow:

Thedesignofeveryformwillbedifferentforeachsituation.DeveloperusersofAccesshavethe
abilitytocreatemenususingmacrosandVBAcodeinordertosuittheneedsoftheirparticular
application.

MicrosoftOfficeAccess2007Advanced

59

CreatingCheckBoxesandCommandButtons

Checkboxesandcommandbuttonscanturnasimpleformintoausableworksheetthatwill
executeoperationsonyourdatabase.Tocreatethesecommands,openaforminDesignview,
clicktheCheckBoxorCommandButtoncommand,andthendraganareaonthecanvasto
placethecommand:

IfweweretoswitchtoFormview,thesecommandswilldonothing.Therealusageofthese
commandsisdefinedbyusingthePropertySheet.Inthecaseofcheckboxes,theproperties
availabletomodifyarecategorizedasfollows:

Format

Thistabcontainscommandslistinghowthecheckboxwillbedisplayed.Commands
includewhenthecheckboxwillbedisplayed,thedimensionsofthecheckbox,
whatmarginsarearoundthecheckbox,theborderwidthandcolorscheme,etc.

Data

Thistabspecifiesthecontrolsourceforthiscommand,ifthecheckboxisbydefault
checkedorblank,anyvalidationrulesforthecheckbox,aswellasifitwillbe
locked.Checkboxescanevenbedisplayedthreeways:checked,unchecked,ornull
(wherethecheckboxoptionwillnotbeconsideredindatabaseoperations.)Check
boxesareveryusefulwhendealingwithBooleandata,suchasaparticularfield
beingmarkedasactiveordiscontinued.

Event

TheEventtaballowsyoutocreateasubroutineusingmacrosorVBAcodethatwill
executeatanypointofinteractionwiththecheckbox(whenitisclicked,ifithas
gainedfocus,ifthemouseishoveredabovethebox,etc.).

MicrosoftOfficeAccess2007Advanced

60

Other

Thistabletsyoucreateanameforthecheckbox,inserttexttodisplayinthestatus
bar,createapopuptipdescribingthepurposeofthecheckbox,andcontrolthe
taborderofthecheckbox.

Whendealingwithcommandbuttons,youcanmodifythefollowingproperties:

Format

Thistabcontainscommandsrelatingtohowthebuttonwillbedisplayed.
Commandsincludewhenthebuttonwillbedisplayed,whatmarginsarearound
thebutton,theborderwidthandcolorscheme,etc.

Data

Thistabspecifiesifthebuttonwillbeenabledordisabledinthisform.

Event

TheEventtaballowsyoutocreateasubroutineusingmacrosorVBAcodethatwill
executedependinghowthebuttonisinteractedwith.Themajorityofthe
functionalityyouwillusewithcommandbuttonswillbeaddedtotheOnClick
command:

Wewilldiscusseventproceduresinthenextsectionofthislesson.
Other

Thistabletsyoucreateanameforthebutton,inserttexttodisplayinthestatus
bar,andcontrolthetaborderofthebutton.

MicrosoftOfficeAccess2007Advanced

61

CreatingEventProcedures

Whencreatingformcomponentsthatcanbeinteractedwith,suchascheckboxesorcommand
buttons,youwillusetheMicrosoftVisualBasiceditor(includedwithAccess2007)tocreate
commandsandactionsusingVisualBasicforApplications(VBA).ConsidertheInventoryList
formintheNorthwindsampledatabase:

Thisformfeaturesacommandbuttonthatwillpurchaseinventoryforthedatabase.Ifwe
examinethepropertiesofthiscommandbutton,weseethattheOnClickcommandhasan
EventProcedurecreatedinVBAassociatedwithit:

MicrosoftOfficeAccess2007Advanced

62

Clickthe

icontoviewtheVBAcodeassociatedwiththiscommand:

ThecreationanduseofVBAcodegoeslargelybeyondthescopeofthismanual.Microsofts
VisualBasiceditorandtheMicrosoftDevelopersWebSitecontainlotsofinformation
regardingthesyntaxandstructureofthisprogramminglanguage.Therearealsoanumberof
booksandmanualswrittenforVisualBasic.

However,noteverycommandthatmakesuseofEventProceduresneedstobecreatedinVBA.
Ifyouarecreatingacontrolfromscratchandclickthe besidetheappropriateEvent
command,youwillbepresentedwithalistofoptionsrelatingtohowyoucancreatethe
functionalityforthiscontrol.

MicrosoftOfficeAccess2007Advanced

63

YoucanchoosetousetheMacroBuildertoperformanaction,ExpressionBuildertoperforma
calculationandreturnaresult,orCode(VBA)Buildertocreateafullycustomizedcontrol.The
listofbuildersavailablewillvarydependingonthecontrolthatistobemodified.Consultthe
AccessDevelopershelpfileorOfficeOnlinetolearnmoreabouttheconstruction,function,
andsyntaxofeachbuilder.

CustomizingErrorMessages

IfyouwillbedevelopingbackgroundcodeforuseinanAccessdatabase,youwillfindthat
beingabletoeffectivelyhandleerrorsinyourcodewillsaveaworldofheadachewhen
producingafinalproduct.Thoughitisnottheintentofthismanualtodescribethedetailsof
VBAprogramming,wewilldiscusstheconceptsbehindusingtheCodeBuildertocatchanddeal
witherrors.

MicrosoftOfficeAccess2007Advanced

64

ConsiderthecodefortheInventoryformintheNorthwindsampledatabase:

TheabovecodeintheForm_InventoryListwindowisdesignedtodealwithknownoutcomes.If
theinventorydoesnotneedtoberefilled,awindowwillappeartotheusersayingthatthe
requiredamountofinventoryisalreadyinthesystem.Iftheinventorywassuccessfullyfilled,
theuserisnotifiedandiftherewassomeproblem,theuserwillalsobenotified.However,a
messagestatingthattheoperationfailedgivesnoindicationastowhatwentwrong.

Whendesigningcodeforthedatabase,andyoubelieveyoumayencountererrorsthatarenot
directlythefaultofthecode,insertingthefollowingcodeblockwillhelplocatetheproblem:

Function MayCauseAnError()
' Enable the error handler.
On Error GoTo Error_MayCauseAnError
.
' Include code here that may generate an error.
.
.

VisualBasichastheabilitytotellyouexactlywhattheerrorisanddisplayitonthescreenby
useoftheErrobject.TheErrobjectcanholddetailsaboutoneerroratatime.Insertthecode:

MicrosoftOfficeAccess2007Advanced

65

MsgBox Err.Message .

Thiswilldisplayinasimpledialogboxwhattheactualerroris.

Ifyouarebuildingextradatabasefunctionalitybasedonamacro,youcandealwitherrorsby
usingtheOnErroractioninMacroDesignview:

SelecttheOnErrorfunctionfromtheActionpulldownlistandthenentertheargumentsforthe
function.Thismayincludeanewvalueforthemacrotouseoranerrormessagethatyouwill
typetothescreendisplayingpossiblecausesfortheerror.

MicrosoftOfficeAccess2007Advanced

66

Lesson2.3:ExportingYourForm

MicrosoftAccessallowsyoutocreateaformthatyoucansendtosomeoneelseviaemail.
UsingMicrosoftOutlook2007incooperationwithAccess2007,youcancollectdatafromall
overtheworldandstoreitinoneplace.

SendingaFormviaEMail

Inordertosendadataformforsomeoneelsetouse,youneedtohaveafewbasescovered.

InadditiontoAccess2007,youmustalsohaveOutlook2007installedandconfigured
withyouremailaccount.
YoucanonlysendforminformationtopeoplewhohaveanHTMLenabledemailclient;
thatisaprogramthatiscapableofreceivingHTMLandplaintextmessages.

Next,youhavetheoptionofstoringrepliesinanexistingdatabaseonyourcomputeror
creatinganewdatabasewhichwillholdonlyreplyinformation.(Lateryoucantransfer
informationfromonedatabasetoanother.)Andlastly,youdontactuallyneedaformallyou
needisatabletostoreinformation,andawizardwillcreateaformforyou.

Considerabasicdatabasewithasingletable:

HighlightthetableintheNavigationPaneandthenclicktheExternalDatatab.IntheCollect
Datasectionofthetab,clickCreateEmail:

Awizardwillnowwalkyouthroughthestepsofcreatingformtogatherinformation.(Infact,
thiswizardissimilartotheformwizard.)

MicrosoftOfficeAccess2007Advanced

67

ClickNexttoadvancepastthefirstscreen:

MicrosoftOfficeAccess2007Advanced

68

Next,selectthetypeofformtouse,eitherHTMLorMicrosoftOfficeInfoPath.Forthisexample,
wewilluseanHTMLform:

MicrosoftOfficeAccess2007Advanced

69

ClickNexttoselectyourtypeofform.NowchoosethefieldsfromtheReplytabletouseinthe
emailform.Atthebottomofthepage,entersometexttodisplayinfrontofthefieldinthee
mailmessage:

ClickNext.Here,youcanspecifyhowyouwouldliketherepliestobehandled.Anyincoming
replieswillbestoredinaspecialfolderinOutlook2007.However,youcanhaveOutlook
transferthedataautomaticallyfromthereplystraightintothedatabase.

MicrosoftOfficeAccess2007Advanced

70

Clickthischeckboxtoenablethisfeature:

ClickNext.Younowhavetheoptionentertheaddressesthatwillreceivetheformmanually,or
useanexistinglistofaddresses.

MicrosoftOfficeAccess2007Advanced

71

Ifyouremailispartofamarketstudyorcompanypoll,youmayalreadyhaveadatabasewith
emailaddressesinsideandcanusethatlistofyoulike:

MicrosoftOfficeAccess2007Advanced

72

ClickNext.Youcannowaddasubjectandmessagetotheemail,orusethedefaultmessage:

MicrosoftOfficeAccess2007Advanced

73

ClickNext.Youarenowreadytocreatetheemailmessage.ClicktheCreatebutton:

MicrosoftOfficeAccess2007Advanced

74

YouwillbeshowntheemailmessageinOutlook2007.Enteryourrecipientsaddresses,and
thenclickSend:

ManagingReplies

Ifyourdatabasehasbeenconfiguredtoenterinformationautomaticallyintothedatabase,you
donotneedtomanageanyreplies.However,ifyouwanttocontrolwhohasaccessandwhatis
beingentered,sendtheemailmessagewithoutcheckingtheboxtoautomaticallyenter
information:

Youthenhavethesameoptiontoeitherenteremailaddressesmanuallyorusealistandthen
customizethesubjectandmessageforyouremail.

MicrosoftOfficeAccess2007Advanced

75

Toseetheresultsoftheemailyouhavesent,openthedatabasefileinnonexclusivemode,
clicktheExternalDatatab,andthenclicktheManageRepliescommand:

AnyreceivedmessagestoyourformwillappearintheManageDataCollectionMessages
window.Ifyouwanttoremoveacertainresponse,thenclicktheDeletethisEmailMessage
button.Thismeansthatthemessageanddatawillbeerased,andnothingwillbeenteredinthe
database.Otherwise,clicktheClosebuttonandanymessageswillhavetheirdatainsertedinto
thedatabase:

MicrosoftOfficeAccess2007Advanced

76

ExportingyourFormtoXML

YoucanexportaformtoExtensibleMarkupLanguage(XML)byusingtheExternalDatatab.
HighlighttheformyouwanttoexportintheNavigationPane(itisnotnecessarytoopenthe
forminFormview)andclickXMLFilefromtheMorecommand:

MicrosoftOfficeAccess2007Advanced

77

Choosealocationinwhichtosavetheexportedfile:

ChoosethesaveoptionsyouwanttoapplytotheXMLfileintheExportXMLdialogbox:

ClickOKtosavetheXMLfile.Accesswillpromptyoutosavetheexportoperationifyoulike.

MicrosoftOfficeAccess2007Advanced

78

TherawdatafilecanbeviewedusingMicrosoftInternetExplorer:

MicrosoftOfficeAccess2007Advanced

79

ClickingtheMoreOptionsbuttonintheExportXMLdialogboxwillexpandindetailhowyou
wantaparticularfiletobesaved.

Data

Exportingonlythedata(likeabove)canbeexpandedtoincludedependant
databaseobjects.Dependingonyourapplication,youcanalsochangethe
encodingthattheXMLfilewilluse.

MicrosoftOfficeAccess2007Advanced

80

Schema

TheSchematabexpandstheXMLfileinmuchmoredetailbyincluding
detailsregardinghowthedataissavedintheformcreatedbyAccess.You
canchoosetoincludetheschemainformationintheXMLfileorcreatea
separateXSDfiletoholdtheinformation.

MicrosoftOfficeAccess2007Advanced

81

Presentation

ThePresentationtaballowsyoutoessentiallyexportafullversionofthe
forminapackagesimilarindesigntoaWebpage.Youcanexportthefile
foruseonalocalmachine(HTML)oronaMicrosoftbasedserver(ASP).
Anypicturesorlogosintheformwillbeincludedinaseparatefolderifyou
wish.

MicrosoftOfficeAccess2007Advanced

82

AfullypackagedformthatwasexportedbyAccesswillappearalmostidenticaltoFormviewin
Access:

MicrosoftOfficeAccess2007Advanced

83

Lesson2.4:UsingOutlookandSharePointwithAccess

IfyouhaveusedanyofthepreviousMicrosoftOfficepackagesyouarenodoubtfamiliarwith
MicrosoftOutlook.Outlookisanemailclientaswellasacontactandpersonalscheduling
software.AccessandOutlooksharesomesimilarities:bothhavetheabilitytostoreand
manageinformationinvolvingcontactsandscheduling,andthereforetheyhavebeendesigned
tobeabletosharethatinformationbetweenthem.Inthislessonwewillcoversomeadvanced
topicsrelatingtotheuseofOutlook2007andAccess2007.

CreatinganRSSFeedforOutlook

RSSstandsforReallySimpleSyndication.AnRSSfeedisessentiallyaspecialtypeofnewsor
informationfilethatcanbesharedtomultipleusers.RSSfeedsarepublishedinaformofXML
(ExtensibleMarkupLanguage)thatcanbeviewedonmultipleplatformsandprograms.

RSSisdifferentthanemailandmoreconvenientthanvisitingseveralWebpagesbecausean
RSSfeedcanbecreatedoutofthecontentfromseveralsources.Whenthefeedisdelivered,it
containsseveralhyperlinksthatbranchouttodifferentlocationsthateachcontainthesource
information.Clickonthelinksyouwanttoreadinordertovisitthem.

RSSfeedsareusuallyfree,andarebecomingwidelyavailable.Anadvantageofsubscribingto
anRSSfeedinsteadofsigningupforanemailmailinglistisyoudonotneedtoprovideyour
nameoremailaddress.WhoeverproducedtheRSSfeedhasnowayofcontactingyouexcept
bysendinganotificationviathefeed.ViewinganRSSfeedrequiresthesamelevelofcautionon
yourpartjustasifyouwereviewingapageontheInternet.Beverycautiousofattachments
includedinanRSSfeedandmakesuretohaveanantivirusprograminstalledonyour
computer.

Toaddafeed,youwillfirstneedtofindsome!WebsitesthatpublishRSSfeedsusuallyhave ,
,or
displayedsomewhereonthepage.(SomeWebbrowsers,suchasMicrosoft
InternetExplorer7,havetheabilitytosubscribetoRSSfeedsbyclickingontheseicons.)Once
youhavedeterminedtheURLoftheRSSfeed,openOutlook2007,andclickToolsAccount
Settings.ClicktheRSSFeedstab.

MicrosoftOfficeAccess2007Advanced

84

TheNewcommandopensadialogboxtoentertheURL:

OnceOutlookhastheproperURL,itwillautomaticallydownloadthenewestcontentforthat
RSSfeed.WheneverOutlookhasconnectiontotheInternet,itwillperiodicallycheckthesource
URLforanyupdatedinformation.

ImportingContactsfromOutlook

IfyouuseMicrosoftOutlookasanemailclientprogram,younodoubthaveaccumulateda
largenumberoremailaddressesandcontactinformation.Accessallowsyoutoimportthis
datausingtheExternalDatatab.

MicrosoftOfficeAccess2007Advanced

85

ClicktheOutlookFolderoptionintheMorepulldownmenuoftheImportsection:

Accesswillpromptyoutoselecthowthesourcedatawillbeusedinthedatabase,whetheritis
importedtoanewtable,addedtotherecordsofanexistingtable,orthedatawillsimplybe
linkedwithaspecialconnectionbetweenOutlookandAccess.

MicrosoftOfficeAccess2007Advanced

86

MakeyourselectionsandclickOK:

MicrosoftOfficeAccess2007Advanced

87

TheImportExchange/OutlookWizardwillappearandasktobrowsetothefolderthatcontains
thecontactinformation.Thismaybeineitherofthehighlightedlocations,dependingonhow
youstoreyourcontactsusingMicrosoftOutlook.

MicrosoftOfficeAccess2007Advanced

88

ThenextstepintheWizardwillaskyoutoconfirmthedataanddatatypesoftheinformation
youwillbeimporting.YoucanmakethesechangesintheFieldOptionsareaoftheWizard.
UnderneaththeFieldOptionsareaisasummaryofthedataasitappearsintheContactsfolder.
Notethethinuprightcolumns(markedwiththearrows):

Thesecolumnsarefieldsinthesourcedatathatdonotcontainanyinformation.Ifyouclick
insidethecolumn,thedata(orlackthereof)willbecomehighlighted(liketheFirstcolumn).You
canchecktheDonotimportfield(Skip)checkboxtoskipoverthehighlightedfield.Doingso
willreducetheamountofunusedspaceinyourdatabasefile.

MicrosoftOfficeAccess2007Advanced

89

Inthenextstep,youcanchoosetoletAccessaddaprimarykeytothenewinformation.You
canchoosetouseanexistingfield,suchastheLastNameorPhonefield,asaprimarykey
(althoughthereisriskofduplication):

ThefinalstepoftheWizardletsyounamethetablethathasbeenimported.Thereisalsoan
optiontoruntheTableAnalyzerWizard.ClickFinishtoconfirmthename.Accessgivesyouthe
optiontosavetheimportstepsforfutureuse.

MicrosoftOfficeAccess2007Advanced

90

Youarenowreadytobeginusingtheimportedcontactsasyouwouldanyothertableinyour
database:

MicrosoftOfficeAccess2007Advanced

91

ImportingContactsfromaSharePointServer

ImportingcontactdatafromaSharePointserverissimilartoimportingfromOutlook.Clickthe
SharePointListcommandintheExternalDatatab:

YouwillbepresentedwiththeoptionofeitherimportingallofthedatafromtheSharePoint
serverorlinkingtothedata.Ifyouimportthedata,youwillhaveaworkingcopythatyoucan
usewhennotconnectedtoyourcompanynetwork.Ifyoulinkthedata,youwillonlybeableto
accessitwhileonline;howeveryouwillalwaysbeworkingwiththemostuptodateversion:(In
thisexamplewewilllinktothedatainsteadofimportingit,asshowninthediagrambelow.)

MicrosoftOfficeAccess2007Advanced

92

MicrosoftOfficeAccess2007Advanced

93

SelectwhichlistcontainedintheSharePointservercontainsthedatayouwanttouse.Checkas
manysourcesthatapplytoyou:

ClickOKtoestablishthelink.Afteramomenttheconnectionwillbeestablishedandyouwillbe
abletoaccessthelinkedobjectthroughtheNavigationPane:

MicrosoftOfficeAccess2007Advanced

94

MovingyourDatabasetoaSharePointServer

Dependingonyoursituation,youmaywishtomovesomeorallpartsofyourdatabasefiletoa
SharePointserver.Infact,alldatabasecomponentsexceptformsandreportscanbemovedto
aSharePointserver.Formandreportobjectswillinsteadbelinkedtothedatabasefileonyour
computer.

ClicktheMovetoSharePointcommandintheSharePointListssectionoftheExternalDatatab:

MicrosoftOfficeAccess2007Advanced

95

AccesswillpromptyoutospecifytheURLoftheSharePointserver.YoucanclicktheBrowse
buttontospecifyaparticularlocationontheserver:

ClickNexttobeginthetransferofdata.

MicrosoftOfficeAccess2007Advanced

96

Youwillseeaprogressbarshowingwhichobjectiscurrentlybeingmovedandhowmuchofthe
fileislefttogo:

Oncetheoperationhasbeencompleted,Accesswilldisplayadialogboxindicatingthe
operationiscomplete,aswellasstateiftherewereanycomplicationswhilethedatabasefile
wasbeingmoved.Accesscreatesabackupfileofthedatabaseforyouoncethefilehasbeen
moved,namedfilename_Backupthatisstoredinthesamefolderastheoriginalfile.

MicrosoftOfficeAccess2007Advanced

97

TheNavigationPanenowlistsallofthelinkedfilesintheNavigationPane:

Oncethedatabasefilehasbeenmoved,thisenablesmembersofyourorganizationtomodify
andupdatethedatadirectlyontheSharePointserver.Eachtimeyouopenthedatabasefile

MicrosoftOfficeAccess2007Advanced

98

fromnowonyouwillneedtohaveanInternetconnectionestablishedinordertoperform
actionsonthedatabase.

PublishingtoaWebServer

Theremaycomeatimewhereyouwillneedtoplaceanentiredatabasefileonsomeexternal
serverthatisnotaSharePointserver.Youmaywanttodothisbecausenoteverycoworkeror
clientmayhavefullaccesstoalloftheprogramsthatyoudo.Forexample,theSharePoint
servermustbeaccessedviaMicrosoftInternetExplorerinordertofullyusethesite.Other
WebbrowserssuchasMozillaFirefoxandNetscapeNavigatordonothaveaccesstoallofthe
featuresuniquetoMicrosoftInternetExplorer.

AccessletsyoupublishyourdatabaseeasilyviatheOfficeMenu.Openthedatabaseyouwish
topublishandclickOfficeMenuPublishDocumentManagementServer:

MicrosoftOfficeAccess2007Advanced

99

Next,choosealocationaslistedinMyNetworkPlacesorontheInternet.Accesswillpackage
thedatabasefileandtransferittothedesiredlocation:

MicrosoftOfficeAccess2007Advanced

100

Section2:ReviewQuestions

A.
B.
C.
D.

Asubformisbestusedtodisplay______________ofaOnetoManyrelationship.
The'one'side
The'many'side
Eithersidewillwork
Neitherside

A.
B.
C.
D.

Whichobjectcanasubformnotbebasedupon?
Table
Query
Form
Report

A.
B.
C.
D.

Whatvisualfeaturecannotbedisabledwheneditingthepropertiesofaform?
Closebutton
Scrollbar
Recordselector
Navigationbuttons

A.
B.
C.
D.

Whatisthemaximumnumberofstatesacheckboxcanbein?
0
1
2
3

1.

2.

3.

4.

WhichbuildercanbeusedintheEventtabwhendealingwithacommandbuttonor
checkbox?
A.
MacroBuilder
B.
CodeBuilder
C.
ExpressionBuilder
D.
Alloftheabove

6.
WhenexportinganXMLfile,youcanchoosetosave:
A.
ThedatainanXMLfile
B.
ThedatapresentationinanXSLfile
C.
ThedataschemainanXSDfile
D.
Alloftheabove

5.

MicrosoftOfficeAccess2007Advanced

A.
B.
C.
D.

RSSfeedsarepublishedwitha__________fileextension
.accdb
.html
.xml
.http

A.
B.
C.
D.

WhichstatementistruewhenadatabasefileissharedonaSharePointserver?
AllSharePointuserslinktotherawdatastoredonyourcomputer
Everypartofthefileisuploadedexceptforformsandreports
Everypartofthefileisuploaded.
Alloftheabove

A.
B.
C.
D.

Openingadatabaseinexclusivemodemeans:
ThefilewillonlybecompatiblewithAccess2007
Thefilewillonlybeopenedforyou
Thefilewillonlybeopenedforsomeoneyouspecify(otherthanyou)
Thefileisreadonlyforanyone

7.

8.

9.

Whichisthebestanswerforthisstatement?Inordertoemailaformtosomeone
else,youmust:
A.
Makeanewdatabase
B.
Makeanewformintheexistingdatabase
C.
MakesuretheyhaveanHTMLenabledemailclient
D.
ProperlyconfigureOutlookExpressorWindowsMail

10.

101

MicrosoftOfficeAccess2007Advanced

Section3:PivotingData

Inthissectionyouwilllearnhowto:
CreateaPivotTableandaPivotChart
LearntheconceptsbehindPivotTablesandPivotCharts
CreateaPivotTableandPivotChartbasedonthesameobject
Pivotdatainordertoshowadifferentviewofthedata
ChangethetypeofgraphusedforaPivotChart

102

MicrosoftOfficeAccess2007Advanced

103

Lesson3.1:CreatingaPivotTable

Databasescanveryquicklygrowtobeverylargeinsize.Thoughreportscanshowyouoneview
ofhowdatarelatestoeachother,onceareportismadeyouwillhavetodesignawholenew
reporttolookatthedatainadifferentway.MicrosoftAccess2007makesuseofPivotTablesto
providedifferentviewsofyourdataonthefly.InthislessonwewilldiscussthePivotTable,and
moveontothePivotChartlaterinthissection.

AboutPivotTables

PivotTablesareawayofdisplayingthedatacontainedinatableorquery.Therealadvantage
ofPivotTablesoversomethinglikeareportisthatyoucancreatedifferentviewsofyourdata
byclickinganddraggingthefields(orpivotingthem)inthetabletodisplaythedataina
differentway.

ConsidertheOrderDetailstableintheNorthwindsampledatabase:

Byhidingandresizingcolumns,wecanseeallofthecolumnscontainingdatapertinenttoour
situation.However,theOrderDetailstablewilllikelyendupbeingquitelong.Everyproductin
everyorderislistedinthistable!Ifwewanttobettercomparewhatdataiscontainedinthis
table,youmightexperimentwithdifferentfilters.However,thistooislimitingcomparedtothe
featuresofaPivotTable.WhatPivotTablesallowustodoistoturntheabovetableintothis:

MicrosoftOfficeAccess2007Advanced

104

Thistableshowshowmanyofeachitemineachpricebrackethasbeensoldbasedonthe
informationintheOrderDetailstable.Forexample,considerthethirdcolumn,labeled10.It
containstheProductIDsofallproductsthathavebeensold10unitsatatime.Eachrow
indicatesthepriceoftheassociatedProductIDs.

Inadditiontoquicklyshowingyoulargeamountsofdata,PivotTablescanbeusedtoobserve
trendsintheproductyousell.AsshowninthePivotTable,manycustomersbuyproductsin
multiplesof10.Itmaybecheaperforyoutoorderyourproductfromyoursupplierinperhaps
multiplesof100insteadofsomearbitrarymiddlevalue.Wewillexploremoreoftheuseof
PivotTablesasweprogress.

CreatingaPivotTable

TocreateaPivotTableliketheoneshownabove,firstselectthetableorqueryyouwantto
basethePivotTableupon.IntheCreatetab,clickthePivotTablecommandintheMoreForms
pulldownmenuoftheFormssection:

MicrosoftOfficeAccess2007Advanced

105

YouwillseethePivotTablecanvasaswellasafieldlistdisplayingthefieldsfromthetableor
query:

TocompletethePivotTablewithdata,clickanddragthefieldsfromtheFieldListtothe
differentsectionsofthecanvas.LetsrecreatethePivotTableseenearlierinthislesson.

MicrosoftOfficeAccess2007Advanced

106

ClickanddragtheUnitPricefieldfromFieldListtotheleftmostpartofthecanvas,marked
DropRowFieldsHere:

MicrosoftOfficeAccess2007Advanced

107

ClickanddragtheQuantityfieldtotheDropColumnFieldsHeresection,andtheProductID
fieldtotheDropTotalsorDetailsHeresection(themiddleofthecanvas):

ThatsallthatisneededcreateabasicPivotTable.Youneedtohavetwocomparisonfieldson
thehorizontalandverticalaxesandsomequantifiablefieldinthemiddle(onethathasmeaning
whencomparedtothefieldsonthehorizontalandverticalaxis).

IfduringtheconstructionofthePivotTableyouplacedafieldinaspotyoudidntintentdo,
simplyclickanddragthefieldnameoffofthecanvas.Thiswillremovethefieldfromthe
PivotTable.ShouldyourPivotTablebecomeverylargewithmanyfields,youcanstilladd
additionalfieldsbyhighlightingthefieldyouwanttouseintheFieldList,selectinganareain
thecomboboxatthebottomoftheFieldList,andthenclickingAddto.

MicrosoftOfficeAccess2007Advanced

108

MoreaboutPivotTableFields

PivotTablesprovidealotoffunctionalityandcantellyouagreatdealofinformation.Lets
explorehowwecanmakeaPivotTableworkforusbyexploringsomeoftheextrafunctionality.
ConsiderablankPivotTablecanvas:

Itcontainsfourmajorcomponents:aplaceforrowandcolumnfields,aplaceforfilteringfields
(likeanoveralltablefilter),andaplacetoputafieldorfieldstobecompared.EachPivotTable
areacancontainmorethanonefield.Thiswillallowausertofurthercategorizeresultsasthey
aredisplayedinthePivotTable.Forexample,consideraddingtheOrderIDfieldtotheRow
fieldssection.ClickanddragtheOrderIDfieldtotheleftoftheexistingUnitPricefield;youwill
seeathickbluelineindicatingwherethenewfieldwillbeplaced:

MicrosoftOfficeAccess2007Advanced

109

NowallofthedatainthePivotTablehasbeencategorizedbyonemoredegree.Thedetailsof
everyorderarenowshowninatabularviewthatiseasiertoreadthanreadingfromrecordsof
atable.

ThedetailshownbyaPivotTablecanbeincreasedevenmorebyaddingafilteringfield.For
example,consideraddingtheStatusIDfieldtothetopofthePivotTable:

TheStatusIDfieldcontainstwovalues.Oneindicateswhichinventoryhasbeeninvoiced(that
is,alreadysoldthroughthesystem)andtheothervalueshowshowmuchofwhichproducthas
beenallocatedforanorderbutnotyetreleasedtothecustomer.Clickthepulldownarrow

MicrosoftOfficeAccess2007Advanced

110

besidetheStatusID(oranyofthefieldsfromthefieldlistalreadyinthePivotTable)toseethe
valuesandchoosewhichonesyouwanttofilterby:

MicrosoftOfficeAccess2007Advanced

111

CompletingyourPivotTable

ToroundoutthedatathatwillbepresentedinthePivotTable,youhavetheabilitytoapply
filters,hidecertaincolumnorrowsofdata,applytotalsandgrandtotals,andmore,tocreated
afinishedlook.Inthefinalsectionofthislesson,wewillexplorehowtoperformthesetasks.

Filterby
Selection

EveryfieldthatisincludedinaPivotTablehastheabilitytobefiltered
basedonthetablevaluesofthatfield.Clickanyofthecheckboxesto
removethatparticularvaluefromconsiderationinthePivotTable.Youcan
alsoclicktheAllcheckboxtoselecteverycheckboxinthelist:

Hide/Show
Specific
Rows/Columns

Clickthesmall+orsignattheheaderofeachroworcolumntoshowor
hideallvaluesassociatedwiththatparticularroworcolumnofdata.

MicrosoftOfficeAccess2007Advanced

112

Subtotalsand
Filters

Ifthedatainthetotals(middle)sectionofthePivotTableisnumeric,you
canapplyanynumberofmathematicaloperationstoitusingtheAutoCalc
feature:

MoreUseof
RightClick

AutoCalcvaluescanbeappliedbyrightclickingonacellinthePivotTable
orfieldname.Youhavetheabilitytoshowthetoporbottomitemsina
table,applyasubtotal,groupandungroupfields,anddisplaymoredetail
aboutaparticulariteminyourPivotTable.

WewillexploremoreoftheuseofPivotTableslaterinthissection,includingthefeaturethat
givesaPivotTableitsname.

MicrosoftOfficeAccess2007Advanced

113

Lesson3.2:CreatingaPivotChart

WelearnedinthepreviouslessonthataPivotTablecaneffectivelycommunicatealotabout
thedataintable.WewillnowlearnaboutacloserelativeofthePivotTable:thePivotChart.In
itssimplestterms,aPivotChartdisplaysingraphformwhataPivotTableshowsintabularform.
Therefore,PivotChartsletyouviewinformationaboutthedatainatableveryquickly.

AboutPivotCharts

APivotChartisagraphicalwayofrepresentingthedatainatableorquery.Considerthe
PurchaseOrderstablefromtheNorthwindsampledatabase:

Nowconsiderwewantedtoseehowmanyofeachproducthasbeenpurchasedandtheprice
categorytheproductfallsinto.Wealsowanttoknowifthereceivedproducthasbeenposted
totheinventoryyet.ThefollowingPivotChartwillbeabletotellusthatinformation:

MicrosoftOfficeAccess2007Advanced

114

CreatingaPivotChart

CreatingaPivotChartisjustaseasyascreatingaPivotTable.First,selectwhichtableorquery
youwouldliketousetocreatethePivotChartintheNavigationPane.Thensimplyclickthe
PivotChartcommandintheCreatetab:

ThePivotChartcanvaswillappearaswellasthelistoffieldsinthecurrenttableorquery:

MicrosoftOfficeAccess2007Advanced

115

ClickanddragthefieldsyouwishtouseinyourPivotCharttotheappropriateplacesonthe
canvas.Tocreateachartliketheaboveexample,clickanddragtheUnitCostfieldtotheDrop
CategoryFieldsHeresectionatthebottomofthecanvas:

Next,movetheQuantityfieldtothecenterofthecanvas.Thiswillcreateasumofthe
quantitiesinthetablebasedoneachpricegroup:

MicrosoftOfficeAccess2007Advanced

116

Finally,movethePostedtoInventoryfieldtotheSeriessectionofthecanvas:

Withtheadditionofmorethanonepossibleitemintheseriessection,noticehowthebarsof
thegraphchangedcolor.Thebluebarinthediagramaboveindicateshowmuchofthe
inventoryforthisparticularlypriceditemhasnotyetbeenpostedtotheinventory.

AswithaPivotTable,youcaneasilyremoveanyfieldsyoudontwantorputinthewrongspot.
SimplyclickanddragthefieldnameoffofthecanvasorbackintothePivotChartFieldList.

MicrosoftOfficeAccess2007Advanced

117

MoreaboutPivotChartFields

PivotChartfieldshavesomeofthesamefunctionalityasthoseinaPivotTable.Clickanyofthe
fieldstorevealapulldownmenuthatcontainsalistingofallvaluesthatfieldscarriedinthe
sourcetable:

TherightmousebuttonalsoplaysapartinhowcertaindetailsaboutyourPivotChartcanbe
displayed.

MicrosoftOfficeAccess2007Advanced

118

Forexample,youcanchooseanumberofothermathematicaloperationsonthemaindata
sourceofthePivotChart:

CompletingYourPivotChart

Becauseoftheirgraphicalnature,PivotChartshavemanyformattingoptionsavailableforuse.
ClickthePropertySheetcommandtoviewthepropertiesoftheselectedobject:

MicrosoftOfficeAccess2007Advanced

119

IntheGeneraltabofthePropertySheetyoucanswitchbetweeneachoftheobjectscurrently
onthecanvas:

HereyoucanrenametheaxisofthePivotChart,changethecharttype,andformatthechartto
lookthewayyoulike.Wewillexploremoreofthesefeaturesindetailinthenextlesson.

MicrosoftOfficeAccess2007Advanced

120

Lesson3.3:UsingPivotTablesandPivotCharts

WenowknowhowPivotTablesandPivotChartsareusefulindisplayingalotofinformationina
hurry.InthislessonwewilllearnmoreaboutthenatureofPivotTablesandPivotChartsand
howtomakedatareallystandout.

UsingaPivotTable

ThebiggestfeatureofPivotTables,andindeedwheretheygettheirname,isintheabilityto
moveorpivotthevariousdatawithouthavingtocreateawholenewtableofadifferentlayout.
ConsiderthefollowingPivotTablebasedonthePurchaseOrderDetailstablefromthe
Northwindsampledatabase:

Itdisplaysthecostofeachproductandthequantityofeachproductthathasbeenpurchased
inthesystem.TheeasiestmethodofusingaPivotTableistoswitchthehorizontalandvertical
fields.Thesamedatawillbedisplayed,butsometimesthedatamaybecomeeasiertoread.
Thetableaboveisquitewide;wecanmakeittallerandavoidalotofsidewaysscrolling.

TopivotfieldsinaPivotTable,clickanddragoneofthefieldtitles(likeQuantityorProductID)
anddragittoanothersectionofthetable.Itdoesnotmatterwhichfieldyoudragfirst.

MicrosoftOfficeAccess2007Advanced

121

LetsvisualizethisbymovingtheProductIDfieldtitletotherightoftheQuantityfieldtitle:

Noticethesmalliconbesideyourmousepointerasyoudragafieldtitle.Intheaboveexample,
thesmalliconindicatesthattheselectedfieldtitle(ProductID)isabouttobemovedtothe
columnsectionofthePivotTable.Oncethefieldtitlehasbeenmoved,youwillseeitdisplayed
besidetheQuantitytitle:

TheabovediagramisindeedaPivotTablethatdisplaysexactlythesamedataasbefore,butall
ofthedataisinthesamerowandmakesitdifficulttoread.

MicrosoftOfficeAccess2007Advanced

122

NowclickanddragtheQuantityfieldtitletotheleftsideofthecanvas:

YoucanaddasmanyfieldsasyouliketoonesectionofaPivotTableinordertodisplaythe
informationinawaythatitsuitedtoyourneeds.However,thingscangetcrowdedquicklyif
youaddtoomanyfieldsthatarenotnecessarilyrelated.Forexample,wecanaddthePurchase
OrderIDtothetotals(center)areaofthePivotTable:

MicrosoftOfficeAccess2007Advanced

123

Asyoucansee,thismightbeusefulinformationforyoursituation;however,itisimpracticalto
read.Theadditionofthisfieldhasmadethetableverywideandyouwillneedtoscroll
sidewaystoviewalldata.PivotingthePurchaseOrderIDtotherowheadingsectionmakesthe
tableabiteasiertoview:

PivotTablesdonotmodifythesourcedatainanywaysoyouarefreetomoveanyfieldsand
applyanyfiltersyouliketothePivotTable.TheleftmostfieldinanysectionofaPivotTableis
theprimarygrouping.Subsequentfieldsaddedontherightwilladdmorelevelsofgrouping.

MicrosoftOfficeAccess2007Advanced

124

UsingaPivotChart

LikePivotTables,PivotChartsgettheirnamefrombeingabletoinsertandpivotanyofthefields
onthecanvas.Considerthefollowingchartshowingthebestsaleeachemployeehadforeach
dateasalewaslogged:

Thoughthescaleisabitsmall,wecanseethatthetwohighestsalesofanyemployee
happenedonthe10thand24thofMarch,2006.However,asNorthwindTraderssellsmoreand
moreintheyearsahead,thischartwillgetwiderandwider.Dependingontheparticularpiece
ofdatayouwanttoemphasize,youcanadjustthefieldsinthischarttobetterreflectthedata.
Ifitisnecessaryforyoutokeepaparticularsetoffieldsinordertodisplaythedatayouneed,
youalsohavetheabilitytochangethetypeofchartthatcanbedisplayed.Wewillexplore
differentcharttypesandoptionslaterinthislesson.

EditingaPivotTableoraPivotChart

ThereareanumberofdifferentwaystoedithowthedataisdisplayedinaPivotTableor
PivotChart.ThoughyoucannotmodifythesourcedatathroughaPivotTable,youcanrefresh
themaindatathatwasusedtocreatethePivotTable.Thiscommandisusefulifyouhaveany
linkeddata,suchastoaSharePointserveroranexternaldatabasefile.

MicrosoftOfficeAccess2007Advanced

125

YoucanfindthiscommandinthePivotTableDesigntab:

NoticethatyoualsohavetheabilitytoexportaPivotTabletoanExcelfile.Thestructureofa
PivotTableisverysimilartothatofanExcelspreadsheet.(Infact,PivotTablesandPivotCharts
arefeaturesincludedwithMicrosoftExcel.)ThisisconvenientforuserswhodonothaveAccess
installedontheirmachinebutwhoareusedtoworkingwithExcelfiles.

WhenworkingwithaPivotChart,itisalmostalwaysnecessarytohavesomesortoflegend.To
displaythelegendinaPivotChart,clickthePropertySheetcommandandselecttheChart
WorkspacefromtheFormatorGeneraltab:

MicrosoftOfficeAccess2007Advanced

126

ClicktheAddLegendbuttontodisplaythemeaningofthebarsinyourPivotChart:

WhenworkingwithaPivotTable,youhavetheabilitytomodifythelookofthetablejustasyou
domanyotherobjectsinAccess.ClickinsideanycellofthePivotTableoranycolumn/row
headingandthenclickthePropertySheetcommandinthePivotTableDesigntab:

Wewillexploretheusageoftheeditingcommandsinthenextsectionofthislesson.

MicrosoftOfficeAccess2007Advanced

127

CommonPivotTableandPivotChartEditingCommands

WheneditingPivotTablesandPivotCharts,thebulkoftheeditingyoucanperform(exceptthe
actualpivoting)canbeperformedbyusingthePropertySheetcommand.

WhendealingwithaPivotTable,thefollowingformattingoptionsareavailable:

FormatTab

Selectwhichobjectonthecanvasyouwanttomodifyandadjust
thelookandfeel:

FilterandGroup

Thistabletsyouapplyvariousfilterssuchasthetop10itemsor
groupthedatainthetablebasedonacertaininterval.

MicrosoftOfficeAccess2007Advanced

128

CaptionsTab

Thecommandsinthistabexpandonthecommandsavailableinthe
Formattab.Thesecommandsdealwiththecaptionandlookand
feelofaspecificgroupofheaders.

Behavior

TheBehaviortabwillonlyappearifyoumodifyanyoftheFiltering
commandsintheFilterandGrouptab.Thecommandsinthe
Behaviortabwillaffecthowthetablewillautomaticallyadjustitself
asthedatainthetableismodifiedbytheadditionoffiltersor
searchcriteria.

MicrosoftOfficeAccess2007Advanced

129

WhendealingwiththechartportionofaPivotChart,theeditingoptionsaresimilar:

GeneralTab

ChangedisplayoptionstocontrolhowthePivotChartwilllook.

Border/FillTab

Thistaballowsyoutoadjustthelookandfeeloftheareasthat
definethechartdata.

MicrosoftOfficeAccess2007Advanced

130

TypeTab

Thistabletsyouchoosewhichtypeofgraphyouwanttouseto
displaythedata.Asyouselectdifferentcategoriesandthetypesof
charts,youwillseethechartbecomeupdatedinrealtime.

3DViewTab

Thistabwillappearifthecurrentchartyouareviewinghasthree
dimensionalelementscontainedinthedesign.Adjustthecamera
angleandlightingwiththistab.

MicrosoftOfficeAccess2007Advanced

131

CreatingaPivotTableandPivotChartfromtheSameObject

BynowyoushouldbecomfortablewiththeuseandpurposeofPivotTablesandPivotCharts.
Wehaveexploredhowtocreatethemandhowtopivotthefieldsinthetabletogettheview
thatworksthebest.However,wehaveonlyexploredseparatecreationofaPivotTableora
PivotChart.Access2007letsyoucreateaPivotTableandaPivotCharttogetherbaseduponthe
sameobject.IfyouclicktheViewpulldownarrowintheHomeordatasheettab,youwillsee
theoptionstocreateaPivotTableandPivotChart:

ThesameistrueoftheViewmenuforaquery,withtheadditionofSQLviewwhichwewill
coverlaterinthismanual:

MicrosoftOfficeAccess2007Advanced

132

Access2007allowsyoutosaveaPivotTableandPivotCharttogetherwithatableorquery
objectinyourdatabase.Thatis,everytimethesameobjectisopened,thecorresponding
PivotTableand/orPivotChartwillalsobedisplayed.ThePivotTableandPivotChartcanbe
createdsimultaneously.ConsiderthefollowingPivotChartconstructedfromthePurchase
SummaryqueryoftheNorthwindsampledatabase:

MicrosoftOfficeAccess2007Advanced

133

IfyouclicktheViewmenuandselectthePivotTableview,youwillseethesameinformation
displayedinPivotTableform:

Asshownintheabovediagram,thetotalscreatedinthePivotChartarereflectedinthe
PivotTable.Also,anychangesmadetothePivotTablewillthereforebereflectedinthe
PivotChart.BecarefulwhenconstructingaPivotTableandPivotCharttogetherinthesame
object.ThedatareflectedinaPivotChartmaybedifficulttoreadinaPivotTable.Ifthisshould
happen,allyouneedtodoiscreateaseparatePivotChartbasedonthesameobject.

MicrosoftOfficeAccess2007Advanced

134

Section3:ReviewQuestions

A.
B.
C.
D.

Whatdoestheterm'pivot'meanwhenconsideringaPivotChart?
Youcanrotatethechartfromlandscapetoportraitmode
Youcanadjustthefieldsinthecharttoreflectthedatainadifferentway
Youcanplacethelegendwhereveryoulikeonthecanvas
Noneoftheabove

A.
B.
C.
D.

APivotTableandPivotChartarespecialtypesof:
Tables
Forms
Queries
Reports

A.
B.
C.
D.

HowmanyfieldscanbeputintotheSeriesareaofaPivotTable?
1
2
Amaximumof3
Asmanyasyoulike

1.

2.

3.

ClickingthepulldownarrowbesideanyfieldinaPivotTableorPivotChartis
essentiallythesameasperforming_______________________onatable:
A.
FilterbyForm
B.
FilterbySelection
C.
AlphabeticalFilter
D.
Noneoftheabove

5.
APivotChartdisplaysin________formwhataPivotTabledisplaysin_________form.
A.
Tabular,Graphical
B.
Graphical,Tabular
C.
Graphical,Series
D.
Tabular,Columnar

6.
Asmoreitemsareaddedtothe__________fieldsectionofaPivotChartbargraph,
morecoloredbarswillbeshowntoreflectthenewdata.
A.
Columnar
B.
Category
C.
Series
D.
Filter

4.

MicrosoftOfficeAccess2007Advanced

135

YoucanaddmathematicaloperationssuchasSumandMax/Minusingthe________
command.
A.
AutoSum
B.
AutoFilter
C.
AutoCalc
D.
PropertySheet

8.
YouhaveaddedaQuantityfieldtotheRowfieldsectionofaPivotTable.Youadda
newfieldtotherowsection.Whereshouldthisnewfieldbeplacedifitistobethemain
groupingfield?
A.
AbovetheQuantityfield
B.
BelowtheQuantityfield
C.
TotherightoftheQuantityfield
D.
TotheleftoftheQuantityfield

9.
UsingtheViewcommand,whichdatabaseobjectcanyouusetomakeaPivotTableor
PivotChart?
A.
Report
B.
Form
C.
Macro
D.
Query

10.
YouwanttocreateaPivotChartandPivotTablefromasinglequery.Whathappensto
thePivotTableifyouaddorremovefieldsfromthePivotChart?
A.
ThePivotTablewillnotbechanged
B.
ThePivotTablewillbedeleted
C.
ThePivotTablewillchangeaccordingtothefieldsyouchange
D.
Noneoftheabove
7.

MicrosoftOfficeAccess2007Advanced

Section4:AccessandWindows

Inthissectionyouwilllearnhowto:
Recoverfromacomputererror
MakeAccessstartwhenyourcomputerstarts
CheckforproblemswithandupdatesforyourinstallationofAccess
DownloadandusetheAccessviewer
UnderstandthebasictermsofSQL
RecognizethepartsofanSQLstatement
MakeyourownSQLstatements

136

MicrosoftOfficeAccess2007Advanced

137

Lesson4.1:AccessandWindows

TheMicrosoftOfficepackageswereprimarilydesignedtorunintheMicrosoftWindows
operatingsystem.FurtheriterationsoftheOfficepackagehavebeenportedforuseinother
operatingsystems,suchastheMacintoshoperatingsystems.BecausetheOfficepackageis
designedtoruninaparticularenvironment,itisalsocapableofusingsomefeaturesofthe
operatingsystem(aswellasbeinglimitedbysomeoftheoperatingsystemsshortfalls!).Inthis
lessonwewillexploretheoperationofAccess2007asawhole.

RecoveringAccess

Despitethebesteffortsofnetworkadministrators,programmers,andhomeusers,therewill
inevitablycomethetimewheresomethingwillgowrong.Viruses,spyware,poweroutages,and
equipmentfailurescancausehavocifyouareunprepared.However,youdohavesometools
availabletouseifyougetstuckwhileusingAccess.

MuchofthedatamanipulationdoneinAccessissavedautomaticallyassoonasaparticular
operationhascompleted.Forexample,whenyouadddatatoatable,itissavedinthetableas
soonasthecursormovestoanotherfield.

TheothermanualoperationsthatcanbeperformedinAccess,suchasthedevelopmentof
macros,formsandreports,mustbesavedbytheuser.However,Accessdoeshaveageneral
AutoSavefeaturethatisusedevery10minutestosaveanyworkthathasbeendone.

ShouldAccessitselfseemunresponsive,theremightbeanumberofcauses.Ifyourcomputeris
experiencingheavynetworktrafficorprocessorload,someoperationsregardingAccessare
placedinapriorityqueue.Withthespeedandcapabilityoftodayscomputers,thisdelaywill
likelybeminor.Nonetheless,thebestfirstoptionistowaitforafewmoments.Ifyouseeno
activity,tryopeninganotherprogramonyourcomputer.Iftheotherprogramdoesnotstart,
thenyoucomputerislikelystuckinaprocessingloopsomewhere.

PressingCtrl+Alt+DeleteintheWindows2000/XPenvironmentwillopentheTaskManager.
ChecktheApplicationstab.Shouldyousee(NotResponding)besideAccessorsomeother
program,highlighttheprograminthelistandclickEndTask.Ifyoudontseeanyunresponsive
programs,itmaybeabackgroundprocess.ClicktheProcessestab.Scrollupanddownthrough
thelistofprocesses.Shouldyouseeoneprogramwitha99%CPUusage,thatprocessislikely
stuck.HighlighttheprocessandclickEndTask.

MicrosoftOfficeAccess2007Advanced

138

IfyoumanagetocloseAccesswithouthavingtorestartyourcomputer,Accesswillhavesaved
abackupfileinthesamefolderastheoriginalworkingfile.Thebackupfilewillbenamed
filename_Backup.

IfworstcomestoworstandyoucannotshutdownWindowsorendaprocess,youmust
physicallypowerofforrestartyourcomputer.

StartingAccessonWindowsBoot

MicrosoftWindowscontainsaspecialfolderinwhichyoucanaddaprogramshortcuttohave
thatprogramstarteverytimeWindowsstarts.Yourcomputermayalreadyhavecertain
programsthatstartwhenyoucomputerstarts,suchasantivirusandinstantmessaging
software.

MicrosoftOfficeAccess2007Advanced

139

TohaveAccess2007startwhenyourcomputerstarts,followthesesteps.Locatetheiconyou
usetostartMicrosoftAccess2007normally,suchasintheStartMenu.Rightclickontheicon,
pointtoSendTo,andthenclickDesktop:

Oncetheiconhasbeencreated,orifyoualreadyhaveanicononyourdesktop,rightclickthe
iconandselectCut:

MicrosoftOfficeAccess2007Advanced

140

Browsetothefollowingfolderonyourcomputer:C:\DocumentsandSettings\<YourUser
Name>\StartMenu\Programs\Startup.Pastetheiconintothefolder:

Everytimeyourcomputerstarts,Accesswillstartaswell.Youcandothisforanyprogramon
yourcomputer.Butbecarefuladdingtoomanyprogramswillsignificantlylengthenthetime
neededtobootyourcomputer.Plus,ifyouwanttouseyourcomputerforapresentationor
somethingotherthantheprogramsintheStartupfolder,youmustfirstwaitforallofthe
programstoopenbeforeyoucanclosethemandfreeupsystemresources.

UsingOfficeDiagnostics

IfyoucontinuallyhaveproblemswhileusingAccess,itispossiblethattheinstallationofOffice
onyourcomputerhassomehowbecomecorruptedordamagedinsomeway.Office2007has
theabilitytodiagnoseandpartiallyrepairitself.OpenanyprogramintheOfficePackageand
clicktheOptionsbuttonatthebottomoftheOfficeMenu:

MicrosoftOfficeAccess2007Advanced

141

ClicktheResourcetabandthenclicktheDiagnosebutton:

MicrosoftOfficeAccess2007Advanced

142

TheOfficeDiagnosticsWizardwillappear:

ClickContinuetobeginthediagnosticsscan.AllofthecomponentsofOfficethataretobe
scannedwillbelistedinthenextstep:

MicrosoftOfficeAccess2007Advanced

143

Theautomatedprogramwillperformanumberoftests.Itwillcheckyourharddiskforerrors
thatcancauseprogramcorruption,itwillchecktomakesureasecurity/operationalissuehas
notyetbeenaddressedanddownloadtheappropriatefix,andscansanyerrorlogsgenerated
byAccessafterrecoveringfromacrash.YouwillneedaconnectiontotheInternetinorderto
completealldiagnostictests.Ifthediagnosticscheckcannotfindasolution,youmayneedto
reinstalltheOffice2007packageonyourcomputer.

MicrosoftOfficeAccess2007Advanced

144

CheckingforUpdates

BackintheResourcesectionoftheprogramoptionsisabuttontoupdateOffice2007:

YourcomputerwillconnecttotheInternetanddetermineifthereareanyprogramupdates
availablebasedonyourcurrentinstallationofMicrosoftOffice.Updateswillbedownloaded
andinstalledtoyourcomputer.Itsagoodideatomakesurenottohaveanyotherapplications
openwhenyourcomputerisapplyingthenewupdates.Oncetheupdateshavebeeninstalled,
youwilllikelyneedtorestarttheOfficeprogramyouwereusinginordertohavetheupdates
takefulleffect.

MicrosoftOfficeAccess2007Advanced

145

Lesson4.2:UsingtheAccessViewer

NoteveryonewillhaveAccessinstalledontheirowncomputer.Inordertobeabletoview
contentgeneratedbycertainOfficeproductssuchasAccess,Excel,andPowerPoint,Microsoft
makesviewingprogramavailableforusefreeofcharge.

WhatistheAccessViewer?

TheAccessViewerisastandaloneprogramthatwillbeabletoviewasnapshotofareportthat
wasgeneratedinAccess.ThiswillletanyonewhodoesnothaveAccessinstalledontheir
computertolookatthedetailsofareport.

DownloadingtheViewer

TheAccessviewerisavailableforfreefromtheMicrosoftOfficeOnlinewebsite.UseyourWeb
browserandvisit:

http://www.microsoft.com/downloads/details.aspx?FamilyId=B73DF33F6D74423D8274
8B7E6313EDFB&displaylang=en

FollowthedownloadinstructionsontheWebpage.Thedownloadisapproximately2
megabytesinsize:

Whenthefilehasbeendownloaded,doubleclickthefiletorunit.Thesetupforthisprogramis
veryeasy;justfollowtheinstructionsonthescreentoinstalltheapplication.

MicrosoftOfficeAccess2007Advanced

146

UsingtheViewer

OpentheviewerbyclickingStartAllProgramsMicrosoftOfficeToolsMicrosoftAccess
SnapshotViewer:

MicrosoftOfficeAccess2007Advanced

147

Whenthevieweropens,clickFileOpen:

TheviewerusesSnapshotfileswhicharecreatedfromreports.

MicrosoftOfficeAccess2007Advanced

148

Theviewergivesyoutheabilitytoscrollthroughthepagesofareport,emailthereport,zoom
inorout,andprintusingthecommandsatthebottomofthewindow.

MicrosoftOfficeAccess2007Advanced

149

IfusingAccess2007tocreatesnapshots,openthedatabasefile,highlightareportinthe
NavigationPane,clicktheExternalDatatab,clicktheMorecommand,andthenselectSnapshot
Viewer:

MicrosoftOfficeAccess2007Advanced

150

Lesson4.3:AnIntroductiontoSQL

ThefinalchapterinouradvancedexplorationofAccessdealswithStructuredQueryLanguage;
orSQLforshort.SQLisafundamentalcomponentofAccessthat,untilnow,hasremainedin
thebackgroundofourexamination.InthislessonwewilltalkaboutwhatSQLis,howknowing
thebasicshelpsputdatabasesbetterintoperspective,andhowyoucancreatesimplequeries
rightaway.

WhatisSQL?

SQL(StructuredQueryLanguage)isessentiallythelanguageusedbymostdatabase
managementprogramstoretrieveinformationfromadatabase.Evenifyouhaveneverdealt
withcomputercodebefore,basicSQLisrelativelyeasytopickup.Thesyntax,orlanguage
rules,iseasytopickupbecauseanSQLstatementisverysimilartoasentenceinEnglish.

IfyouareinterestedinreadingmoreaboutSQLforMicrosoftAccess,becarefulthereare
manydifferenttypesofSQL.Thoughthecorecomponentsofthedifferentlanguagesare
basicallythesame,therearealotoffinerpointscontainedwitheachSQLversion.

PartsofanSQLStatement

StructuredQueryLanguagelivestruetoitsname:itisadefinedsetoflanguagerules,including
punctuation,usedtocreateaquerytoaskadatabaseaquestion.Letstakeaquicklookata
simpleSQLquery.

SELECT Customer.Country FROM Customers WHERE Customer.TotalSales >= 10000;

Thekeywordsareincapitalletters.TheentriesintheformSomething.SomethingElsedescribe
aparticulartablefield.Customers.CountrymeanstheCountryfieldfromtheCustomerstable.
Thelogicaloperator>=meansgreaterthanorequalto.Therefore,theabovequeryreads
Showallthedistinctcountrynamesfromthecustomerstablethathaveboughtmorethan
$10,000worthofourproduct.

Or,asfarasthedatabaseisconcerned,Selectthisfromthattablewherethisconditionis
true.Queriescanbedesignedtoretrieveseveralpiecesofdatainsteadofjustone(like
Customer.Country,Customer.Name,Customer.Whatever)andwildcardcharacterslikethe
asterisk(*)canbeusedtorepresentanythinginaquery.Forexample,thequery

SELECT * FROM Customer;

MicrosoftOfficeAccess2007Advanced

151

ThisqueryessentiallyhastheabilitytocopytheentireCustomerstablebecausethisquery
retrieveseverypieceofinformationintheCustomertable.

SQLKeywords

Therearealmost300reservedkeywordsand140nonreservedkeywords,giveortake,
dependingonwhatSQLversionyouareusing.Wedonthavethespacetodescribeallofthem
here,butwewillcoversomeofthemainones.Infact,youlikelyalreadyknowthedefinitionsof
mostofthekeywordsalready!

CREATE

TheCREATEkeywordisusedtocreateatableinSQL.Thefollowingstatement
createsanewtablenamedemployees:

CREATE TABLE Employees (Employee_ID VARCHAR(3),


Employee_Name VARCHAR(30),
Salary DECIMAL(7,2));

ThetableisnamedEmployees.Ithasthreefields:Employee_ID,Employee_Name,
andSalary.ThefirsttwofieldsaredefinedasaVARCHARdatatype,orvariable
character.Thismeansthefieldscancontainalphanumericdata.TheSalaryfieldis
definedasadecimalnumber,withsevenfiguresandtwodecimalplaces.Each
employeecanearnupto$9,999,999.99(whichshouldbeenough!)
DELETE

TheDELETEkeywordisusedtodeletedatainatable.Thefollowingstatement
deletesdatainatablenamedEmployees:

DELETE TABLE Employees


WHERE [search criteria];

Thesearchcriteriaareoptional.Ifnosearchcriteriaareentered,thenalldatain
thetablewillbedeleted.TheDELETEcommanddoesnotactuallyremovethe
tabledefinition;theDROPcommand(below)willerasethetablecontentsand
structurecompletelyfromthedatabase.
DROP

TheDROPkeywordisusedtodeleteatablefromthedatabase.Thefollowing
statementdeletestheEmployeestable:

DROP TABLE Employees;

TheDROPcommandcanbeextendedwiththeuseofthekeywordsRESTRICTED
andCASCADE.Ifyourecallhowreferentialintegrityworksinadatabase,these
keywordswillallowornotallowatabletobedeletedincaseotherdatabase

MicrosoftOfficeAccess2007Advanced

152

objectsdependontheobjecttobedropped.

TheRESTRICTEDkeywordwillnowallowtheDROPoperationtoproceedifthere
aredependantobjects.TheCASCADEkeywordwillremovetheselectedtableand
alldependantobjects.Forobviousreasons,theCASCADEoperationshouldbe
usedwithextremecaution!
INSERT

TheINSERTcommandisusedtoadddatatoatableinthedatabase.Thefollowing
statementwilladdanewemployeerecordtotheEmployeestable:

INSERT INTO Employees VALUES(G32, John Smith, 45339.40);

ThefirsttwoargumentsintheVALUESsectionofthestatementareinsingle
quotationsbecausetheymaycontainletters,numbers,orsymbols.Thisisbecause
bothvaluesareofthedatatypeVARCHAR.Thefinalargumentaddsthesalary
withinthedefinedlimitsofthedatatypeDECIMAL(sevendigitsbeforethe
decimal,twodigitsafter)
SELECT

TheSELECTcommandisusedtoretrieveinformationfromadatabase.The
followingstatementwillselectalldatafromtheEmployeestable:

SELECT * FROM Employees;

AlldatacontainedintheEmployeestablewillbereturnedtotheuserforreview.
SELECTstatementsareusuallymuchmorespecific.Thefollowingstatementwill
selecttheEmployee_IDandEmployee_NamefromtheEmployeestablebasedon
certaincriteria:

SELECT Employee_ID, Employee_Name


FROM Employees
WHERE Salary <30000;

TheEmployee_IDandEmployee_Nameofeachemployeethatmakeslessthan
$30,000.00willbereturnedtotheuser.
UPDATE

TheUPDATEcommandisusedtoupdateinformationinadatabase.Thefollowing
statementwillupdateallrowsoftheEmployeestablebasedonacriteria:

UPDATE Employees
SET Salary = Salary * 1.05
WHERE Position = Manager;

MicrosoftOfficeAccess2007Advanced

153

Ifyounotice,allofthecommandsdescribedherearehandledbymeansoftheQueryWizard
andthesyntaxishandledbyqueryDesignview.Itisimportanttonotethatitisnotnecessary
tohavethequeriesseparatedondifferentlines;thismerelymakesthequeryeasiertoread.
ConsiderthefollowingqueryintheNorthwindsampledatabase:

Youwillnoticethatthequantifiedfieldsareenclosedinsquarebrackets.ThisisbecauseAccess
2007hastheabilitytohavespacesinafieldname.ThebracketsallowtheSQLengineto
interpretthewordsOrderandDatetogetherasoneentity.OtherwisethewordDatewould
beconsideredasakeywordwhichdoesnotexistintheSQLlibrary,causinganerror.The
importthingtorememberisthatallcommasareinsertedproperly,allparenthesesareclosed,
andthereisasemicolonattheendofeverystatementtocompleteit.Asyoubecomemore
comfortablewithusingSQL,youwillbeabletomodifythequeriesthatAccessgeneratesby
itself.

MicrosoftOfficeAccess2007Advanced

154

AddingWhereClauses

SELECTstatementscanincludemultiplesearchcriteria.Whensearchingusingmultiplesearch
criteria,youcanuseseverallogicaloperatorslikeANDandOR,orquantifierslikeBETWEEN:

SELECT * FROM Employees


WHERE Hire_Date = 01-May-06
AND Salary >= 40000
AND ;

SELECT * FROM Employees


WHERE Salary = 30000 OR Salary = 35000;
SELECT * FROM Employees
WHERE Hire_Date BETWEEN 01-May-06 AND 01-June-06;

Whensearchingbasedonmultipletables,eachfieldyouentermustbequantified;thatisyou
musttelltheSQLenginewhichtabletolookin:

SELECT Employees.Employee_ID, Order_Details.Employee_ID,


Order_Details.Order_Total
FROM Employees, Order_Details
WHERE Employees.Employee_ID = Order_Details.Employee_ID;

MicrosoftOfficeAccess2007Advanced

155

Section4:ReviewQuestions

1.
A.
B.
C.
D.

Whatsortofprogramsshouldyouinstallonyourcomputertohelpprotectyourdata?
BonsaiBuddies
FileSharingprograms
AntispywareandAntivirus
Alloftheabove

WhenusingtheWindows2000/XPoperatingsystem,whatutilitywillappearwhen
youpressCtrl+Alt+Delete?
A.
ActiveProcessManager
B.
TaskManager
C.
MicrosoftConfigurationUtility
D.
InternetExplorer

3.
Whereshouldyouaddanicontomakeaprogramstartwhenyourcomputerstarts?
A.
Theharddriverootdirectory(C:\)
B.
Thedesktop
C.
TheWindowsprogramfolder
D.
TheStartupfolder

4.
SQLstandsfor
A.
StructuredQueryLanguage
B.
SimpleQueryLanguage
C.
StructuredQueryLine
D.
ScheduledQueryLanguage

5.
Whatiswrongwiththisquery?

2.

SELECT Customer.Country
FROM Customers
WHERE Customer.TotalSales >= 10000

A.
B.
C.
D.

TheCustomertableisnotquantified
Thequeryisallononeline,itshouldbeonseverallines
ThereisnodecimalpointintheTotalSalesWHEREclause
Thereisnosemicolon

MicrosoftOfficeAccess2007Advanced

A.
B.
C.
D.

WhichstatementisfalseabouttheDELETEcommand?
ADELETEcommandwilleraseallrecordsinatable
ADELETEcommandwillerasetheentiretable
ADELETEcommandcanselectivelyselectrecordsifaWHEREclauseisincluded
ADELETEcommandisdifferentfromtheDROPcommand

A.
B.
C.
D.

WhatfileextensionisusedbytheSnapshotViewerprogram?
.jpg
.snp
.accdb
.pfd

A.
B.
C.
D.

WhatobjecttypeisvisibleintheSnapshotViewerprogram?
Queries
Tables
Macros
Reports

A.
B.
C.
D.

Whichoperation,ifany,cannotbeperformedintheSnapshotViewerprogram?
Print
Movetopreviouspage(<)
Movetolastpage(>|)
Alloftheabovearevalidoperations

A.
B.
C.
D.

WhichfileformatmayresultinviewingproblemsfortheSnapshotViewerprogram?
Access97
Access2007
Access2000
AccessXP

6.

7.

8.

9.

10.

156

MicrosoftOfficeAccess2007Advanced

157

Index

AccessViewer ................................................................................................. See Snapshot Viewer


AutoSave ..................................................................................................................................... 137
DatabaseNormalization ........................................................................................................... 1,14
1NF ................................................................................................................................ 14,15,45
2NF ................................................................................................................................ 15,16,45
3NF .......................................................................................................................... 15,19,27,45
Whatis? .................................................................................................................................... 14
ErrObject ...................................................................................................................................... 64
ExpressionBuilder........................................................................................................... 42,63,100
Forms
Checkboxes .............................................................................................................................. 59
Commandbuttons .................................................................................................................... 60
Emailing ................................................................................................................................... 66
Errormessages.......................................................................................................................... 63
EventProcedures ...................................................................................................................... 61
ExportingtoXML....................................................................................................................... 76
Limitingaccess .......................................................................................................................... 57
Managingrepliesto .................................................................................................................. 74
Indexing......................................................................................................................... 9,26,27,45
MacroBuilder ....................................................................................................................... 63,100
MicrosoftOfficeAccess2007
Frozen ..................................................................................................................................... 137
Startingonboot ...................................................................................................................... 138
MicrosoftOutlook
Importingcontactsfrom ........................................................................................................... 84
Sendingformsfrom .................................................................................................................. 66
ModalDialogBoxes ...................................................................................................... 1,35,42,46
AddingControls......................................................................................................................... 37
Creating..................................................................................................................................... 35
Formatting ................................................................................................................................ 43
Properties.................................................................................................................................. 41
OfficeDiagnostics ............................................................................................................... 140,142
OfficeUpdates ............................................................................................................................ 144
OnErrorAction .............................................................................................................................. 65
PivotChart
Creating................................................................................................................................... 114
Fieldlist ................................................................................................................................... 115
Legends ................................................................................................................................... 125
Mathematicaloperations ....................................................................................................... 118
PropertySheet ................................................................................................................ 118,129

MicrosoftOfficeAccess2007Advanced

158

Refreshingdata ....................................................................................................................... 124


Using ....................................................................................................................................... 124
Whatis? .................................................................................................................................. 113
PivotTable
Creating................................................................................................................................... 104
Fieldlist ................................................................................................................................... 108
Filtering ................................................................................................................................... 111
PropertySheet ........................................................................................................................ 127
Refreshingdata ....................................................................................................................... 124
Showingandhidingcolumnsorrows..................................................................................... 111
Subtotals ................................................................................................................................. 112
Using ....................................................................................................................................... 120
Whatis? .................................................................................................................................. 103
PublishingtoDocumentManagementServer.............................................................................. 98
ReferentialIntegrity.....................................................................................1,9,10,11,23,45,151
CascadeDelete.................................................................................................................... 10,23
CascadeUpdate .................................................................................................................. 10,23
Relationships
Designtab ................................................................................................................................... 3
Joinlines.................................................................................................................................... 13
Report ......................................................................................................................................... 4
Types ........................................................................................................................................... 7
View ............................................................................................................................................ 2
RSSFeed.................................................................................................................................. 83,84
SharePointServer ................................................................46,47,91,93,94,95,97,98,101,124
Importingcontactsfrom ........................................................................................................... 91
Movingdatabaseto .................................................................................................................. 94
SnapshotViewer ................................................................................................................. 146,156
StructuredQueryLanguage(SQL) ...................................................................................... 150,155
CREATE .................................................................................................................................... 151
DELETE..................................................................................................................................... 151
DROP ....................................................................................................................................... 151
INSERT ..................................................................................................................................... 152
Keywords......................................................................................................................... 150,151
Operators ................................................................................................................................ 150
Partsofstatement .................................................................................................................. 150
SELECT ..................................................................................................................................... 152
UPDATE ................................................................................................................................... 152
Whatis? .................................................................................................................................. 150
WHERE .................................................................................................................................... 154
Subform
AndFormWizard ...................................................................................................................... 50
Creating..................................................................................................................................... 48
Displaying.................................................................................................................................. 56

MicrosoftOfficeAccess2007Advanced

159

Editing ....................................................................................................................................... 52
PropertySheet .......................................................................................................................... 53
Syncingwithparentform ......................................................................................................... 55
Using ......................................................................................................................................... 53
Whatis? .................................................................................................................................... 48
Switchboards....................................................................................1,28,30,31,32,33,34,35,46
AndAccess2007 ....................................................................................................................... 28
Creating..................................................................................................................................... 31
Deleting..................................................................................................................................... 34
Editing ....................................................................................................................................... 32
Using ......................................................................................................................................... 29
UsingManager .......................................................................................................................... 30
Whatis? .................................................................................................................................... 28
TableAnalyzer............................................................................................................... 1,17,45,89
Tabs
Create........................................................................................................................ 35,104,114
DatabaseTools.......................................................................................................... 2,16,30,46
ExternalData........................................................................................66,75,76,84,91,94,149
FormToolsDesign .................................................................................................................. 49
PivotTableDesign ......................................................................................................... 125,126
VisualBasicforApplications ....................................................28,33,43,53,58,59,60,61,62,63

You might also like