office of information technology
TRANSCRIPT
-
8/14/2019 OfficeofInformationTechnology
1/41
OfficeofInformationTechnology
Access2007FormsDesign
-
8/14/2019 OfficeofInformationTechnology
2/41
Access2007FormsDesign Page2of41
BasicFormControls........................................................................................................................ 3
AddingaControl......................................................................................................................... 3
UsingtheControlWizard............................................................................................................ 9
Cutting,Copying,Pasting,andMovingaControl..................................................................... 10
FormattingaControl
.................................................................................................................
14
AdvancedFormControls.............................................................................................................. 15
ModifyingaControlsProperties.............................................................................................. 15
ChangingaControlsDataSource............................................................................................. 18
ChangingaControlsDefaultValue.......................................................................................... 20
CreatingaCalculatedControl................................................................................................... 21
UsingFormProperties.............................................................................................................. 24
FormattingYourForm................................................................................................................... 25
FormattingGridlines................................................................................................................. 25
ModifyingtheFont................................................................................................................... 26
AddingLogos............................................................................................................................. 28
ChangingtheLayout................................................................................................................. 29
FormattingControls...................................................................................................................... 30
ChangingtheColorofaControl................................................................................................ 30
UsingControlProperties........................................................................................................... 31
Aligning
Controls
.......................................................................................................................
32
FormattingRecords....................................................................................................................... 34
ModifyingFonts........................................................................................................................ 34
UsingAutoFormat..................................................................................................................... 34
UsingtheArrangeRibbon......................................................................................................... 39
-
8/14/2019 OfficeofInformationTechnology
3/41
Access2007FormsDesign Page3of41
BasicFormControlsBy
now
you
should
be
very
comfortable
with
creating
and
controlling
data
contained
in
the
tablesofyourdatabase.Inthecominglessons,wewilllearnhowtomakethedatabasemore
usablebyusingforms.
Formsinadatabasearejustlikepaperforms:informationiswrittenonaform,andthe
informationontheformisenteredintoadatabaseorkeptonfileinsomewayforretrieval
later.Accesscanmakesomeverypowerfulandfunctionalformsforusewithyourdatabases,
soletsexplorehowtheywork.
AddingaControlFormshavetwobasicfunctions:theyprovideameanstoinputdataandtheycanperform
actionsonthedatabase.Therefore,thethingsthatyouinteractwithonaformareeithertext
fieldswheredataisenteredinsomeway,orcontrolsthatperformsomeactiononthedatain
theformoronthedatabase.
Everyformincludessomesortofcontrol.Inthislesson,wewillexploresomeofthe
functionalityprovidedbyforms.UsetheCreateribbontoviewtheFormcommands:
Hereiswhatthedifferentcommandsdo:
Form Thiscommandisusedtocreateaformbasedonatableinyourdatabase.Accesswillautomaticallycreateaformthatcontainsall
ofthefieldsinthehighlightedtable.SplitForm Thiscommandcreatesaformthatcontainstwoparts.Thetoppart
isjustlikedatasheetview;youcanseeallrecordscontainedinthe
tableorqueryuponwhichtheformisbased.Thebottomsectionis
anormalform.
MultipleItems Thiscommanddisplaysalltheinformationinatableorqueryinaspecialdatasheetview.Thisviewallowsyoutoseeseveralrecords
atatime,eachdisplayedlikeasingleformentry.
-
8/14/2019 OfficeofInformationTechnology
4/41
Access2007FormsDesign Page4of41
PivotChart PivotChartsareusedbyAccessasawaytoquicklydisplayinformationinagraphicalway.Thoughtheyarebeyondthescope
ofthismanual,PivotChartsletyoudragtwoormorefieldstothe
axesofachart.Thenumericaldatacontainedinthefieldswillbe
displayed.Thetermpivotmeansyoucanclickanddragoneor
morefields
from
one
axis
to
the
other,
therefore
pivoting
the
data
todisplayitinadifferentway.
BlankForm Thiscommandcreatesanewemptyformwithablankcanvas.MoreForms Thiscommandopensasmallmenucontainingothercommands
relevanttotheuseofforms:
FormWizardwalksyouthroughthecreationofaform.Theendresultisacompleteworkingformthatcanbeusedright
away.
TheDatasheetcommandcreatesanewemptyform,butonethatyoucanusetoinsertdatalikeatable.Datasheet
formsarebeyondthescopeofthismanual.
Modaldialogueallowsyoutocreateanewformthatlooksjustlikeadialoguebox.ModalDialogueformsalsofeature
OKandCancelbuttonsbuiltin.
PivotTablesareawaytodisplaynumericaldataquickly.JustlikePivotCharts,fieldscanbemovedfromoneaxisto
anothertodisplayinformationaboutyourdataina
differentway.
FormDesign ThiscommandopensthecurrentlyselectedforminDesignview.
Letsaddacontroltoablankform.First,openanewblankformbyclickingtheBlankForm(
)commandintheCreateribbon.
-
8/14/2019 OfficeofInformationTechnology
5/41
Access2007FormsDesign Page5of41
Next,usetheViewmenuintheFormTools FormattingorHomeribbonandswitchtoDesign
view:
ThemajorityofcontrolsinAccesscanbeaddedtoaforminAccessbyclickinganddraggingan
areayou
want
to
designate
for
the
control.
For
example,
if
you
wanted
to
add
aText
box
to
the
emptyform,clickthetextboxcommandandthendraganarea:
Asyouclickanddrag,youwillseeacertainareaoftherulersturnblacktoindicatehowlarge
thecontrolis.Dontworryaboutmakingthecontrolsanexactsize;everycontrolcanbemoved
-
8/14/2019 OfficeofInformationTechnology
6/41
Access2007FormsDesign Page6of41
andresizedlater.Thetextboxcannowhavetextaddedtoit,andthelabelbesidethetextbox
canbemodifiedtodescribewhatthetextboxisfor:
Access2007featuresawiderangeofcommandsthatcanbeusedinaform.
ManyofthecommandsyoucanuseareverysimilartoonesusedintheMicrosoftWindows
operatingsystem.Letsquicklylookatwhateachicondoes:
Logo ThelogocommandpromptsyouforanimagefiletouseintheFormHeadersectionoftheForm.Itwillalwaysbepresentatthe
beginningofthepage.
Title ThiscommandaddsatitletotheFormHeadersection.
PageNumbers ClickthiscommandtoshowthePageNumbersdialoguebox.Selecttheoptionsandpositionyouwanttouseforyourform.
-
8/14/2019 OfficeofInformationTechnology
7/41
Access2007FormsDesign Page7of41
DateandTime ThiscommandshowstheDateandTimedialoguebox.Itallowsyoutoselecttheformattingoptionsyouwantforyourform:
TextBox Clickthiscommandandthenclickanddraganareaonthecanvastoaddthetextbox.Atextboxcanholdanytypeofdata
exceptgraphical.
Label Nearlyeverycontrolhasanassociatedlabel,onethattellsyouwhatthecommandiscalled.Clickanddraganareainthe
canvas.
Button Abuttonisusedtoperformsomesortofaction,liketheOKandCancelbuttonsofadialoguebox.Clickanddragthesizeof
buttonyouwant.
ComboBox Youshouldbeveryfamiliarwiththefunctionofcomboboxesbynow.Usecomboboxestohavetheuserpickanoptionoutofa
listofoptionsbyclickingthepulldownarrow.
ListBox Aboxthatworkssimilartoacombobox,butitcanbeexpandedto
show
all
of
its
contents.
A
user
simply
picks
the
option
out
of
thelisttheywanttouse.
Subform/Subreport Letsyoucreateaforminsideaformorareportinsideareport.
Line Clickanddragtodrawalineintheform.Usefulfordividingup
-
8/14/2019 OfficeofInformationTechnology
8/41
Access2007FormsDesign Page8of41
theformcomponentsintogroupssotheyareeasiertoread.
Rectangle Drawrectanglesintheformtohelpprovideavisualgroupofrelatedcomponents.
BoundObjectFrame Allowsyoutoenterandcontrolvariousexpressionsandlowleveloperationsthatcanbeperformedonthedatabase.OptionGroup Clickanddragaboxaroundagroupofcontrolstogroupthem
together.Usefulwhenusingradiobuttons;userscanselectone
optionoutofthegrouptoperformacertainaction.
CheckBox Whenchecked,theconditionboundtothecheckboxistrueoractive.Whenunchecked,theconditionisfalseorinactive
Option(Radio)Button
Usedtoselectacertainoption,andalmostalwaysingroupsof
twoor
more.
ToggleButtons Atogglebuttonscommandstaysineffectwhenclickedandwillremainsountilitisclickedagain.
TabControl Letsyoucreateaseriesoftabsinyourform,eachwithitsownoptions.Usefulifyouhavealargenumbersofcontrolsina
framethatcanbecategorized.
InsertPage Usethiscommandtoinsertapageintoacertainsectionofaform.
InsertChart ClickanddraganareaintheformtoopentheChartWizard.ThisWizardwillanalyzethedatacontainedinaqueryorreport
anddisplaydataforyouinagraphicalway.
UnboundObjectFrame Allowsyoutocreateaspecialwindowinsideaframethatyoucanusetoviewsomeotherdocumentwhilelookingatyour
form.Forexample,youcouldhaveasmallwindowcontaininga
PDFdocumentoraPowerPointpresentation.
Image Allowsyoutoplaceapictureinyourform.PageBreak Usedtocreateacutoffpointwhenprintingadocument.Even
thoughyoumaybeabletoseeeverythingonyourscreen,a
newpagewillalwaysprintoffwhenapagebreakis
encountered.
Hyperlink Thiscommandwillcreatealinktoanotherfile,Webpage,orresourceexternaltoyourdatabase.
-
8/14/2019 OfficeofInformationTechnology
9/41
Access2007FormsDesign Page9of41
Attachment Usethiscommandtoviewnonalphanumericdatacontainedinyourdatabase.
LineThickness Choosethethicknessofthelineyouhavecurrentlyselectedorareabouttomake.
LineType Choosealinepattern.LineColor Choosealinecolor.SpecialEffect Youcanapplyaspecialeffecttoabuttonorothercontrolto
makeitlooklikeitis3D,flat,orsunkenintotheform.
SetControlDefaults Usethiscommandtorevertacontrolspropertiesbacktothedefaultsetting.Select
All
Use
this
command
to
select
all
controls
contained
in
a
form.
Select Thiscommandletsyouselectacontrolsoyoucanmoveitaroundthecanvas.
UseControlWizards TogglethiscommandtohaveAccessautomaticallystartaWizardtohelpwiththecreationofdifferentcommandsina
form.
ActiveXControls ActiveXcontrolsarespecialtypesofcontrolsthatareusedtoenhancethefunctionalityofaform.Theycanbeusedassmall
toolbarsorapplicationsthatexecutefrominsideaform.
UsingtheControlWizardTheControlWizardoption,whenselected,willstarttheappropriateWizardtoguideyou
throughsettingupOptionGroups,ComboBoxes,ListBoxes,CommandButtons,Subforms,and
Subreports.Itisagoodideatoleavethistoggled(indicatedasactivewhenitisorangeincolor)
toguideyouthroughsettingupacontroluntilyoureachapointwhereyouarecomfortable
designingacontrolonyourown.
-
8/14/2019 OfficeofInformationTechnology
10/41
Access2007FormsDesign Page10of41
Whenyouclickanddragtheareayouwanttouseforthecontrol,theappropriateWizardwill
begin:
FollowthedirectionsprovidedintheWizardtoformatyourcontrol.
Cutting,Copying,Pasting,andMovingaControlThankstotheinteractiveandgraphicalcontrolprovidedbymostcomputerprograms(including
MicrosoftOffice)manyobjectscanbecut,copied,pasted,andmovedonyourscreen.When
workingwithaform,Accessletsyouperformalloftheseoptionswithyourmouse.
-
8/14/2019 OfficeofInformationTechnology
11/41
Access2007FormsDesign Page11of41
Letsconsiderthefollowingform,completewithafewbasiccontrols:
Youdecidethatthisformisnolongercompletelyservingyourpurposesandneedssome
adjusting.Thecomboboxisnotneeded,soitcanbecut.Youwilluseanothercheckbox,soyou
cancopyandpastetheoneyoualreadyhave.Andeverythingcanbeshiftedupintheformto
accountforthelossofthecombobox.
Toperformtheseactions,opentheforminDesignview.Whenyouclickonaform,youwillsee
thefollowinghandlesappear:
Inthediagramabove,thelabelforthecomboboxwasclickedtoselectit.Thelargebrownbox
intheupperlefthandcornerofthecontrolisusedtomovethecontrol,andthesmallerboxes
aroundtheoutsideedgeareusedtoexpandtheobjectinacertaindimension.Noticetoohow
thereisalargebrownboxintheupperlefthandcornerofthecomboboxitself;thismeans
thatthecomboboxisrelatedtothelabelthatiscurrentlyselected.
Tocutthecontrolwhenselected,pressCtrl+Xonyourkeyboard.Thelabeldisappearsandisplacedintheclipboardofthecomputer,butthecomboboxitselfstaysbehind.Thismightbe
usefulinsomescenariostohaveonlythecomboboxvisible,butforthisexamplewewantto
removetheentirecomboboxandlabel.
-
8/14/2019 OfficeofInformationTechnology
12/41
Access2007FormsDesign Page12of41
PressCtrl+ZtoundotheCutoperation,andinsteadclickanddragaselectionboxaroundthe
controls:
Nowpress
Ctrl
+Xto
cut
the
control.
If
you
are
planning
on
removing
the
combo
box
for
good,
youmightconsiderjustdeletingitinstead;simplyhighlighttheobject(s)andpressDeleteon
yourkeyboard.
ClickanddragaboxaroundtheCheckBoxanditslabel,andthenpressCtrl+C.Thisstoresa
copyofthecontrolintheclipboardofthecomputer.NowpressCtrl+Vtopastethecopied
checkbox:
Thenewcheckboxispasted,butdoesntlookverygoodwhenpastedontopofanother
control!
-
8/14/2019 OfficeofInformationTechnology
13/41
Access2007FormsDesign Page13of41
Usethearrowkeysonyourkeyboardtomovethecontrolupandtotherightofthefirstcheck
box:
Nowallofthecontrolsintheformcanbemoveduptooccupythespaceleftbehindbythe
combobox.Clickanddragaselectionboxaroundallofthecontrols,andthenusetheuparrow
onyourkeyboardtoshiftallofthecontrolstothetopoftheform:
-
8/14/2019 OfficeofInformationTechnology
14/41
Access2007FormsDesign Page14of41
FormattingaControlThedefaultstyleofformmaybefunctionalbutnotverygoodlooking.Youcanenhancethe
lookofacontrolbyusingtheFontsectionoftheFormTools Designribbon(ortheFont
sectionof
the
Home
ribbon).
If
you
are
familiar
with
Microsoft
Word
or
Excel,
or
other
such
softwareapplications,thistoolbarshouldlookfamiliar:
Hereyou
can
adjust
the
font,
font
size,
make
the
font
bold,
change
the
color,
or
apply
a
backgroundcolor.Ifyouapplyanewformattoacontrolanddontlikethelookofit,youcan
pressCtrl+Zonyourkeyboardtoundotheformattingchange.Also,ifyoumakeafontlarger
butcantseetheentirelabel,clickthelabelyoujustmodifiedanddragthesmallbrownboxes
aroundtheoutsideedgeinthedimensionyouneedtoexpand.
-
8/14/2019 OfficeofInformationTechnology
15/41
Access2007FormsDesign Page15of41
AdvancedFormControlsInthelastlessonwelearnedthataddingcontrolsandformattingthemiseasytodo.Nowwe
willintroducehowtomaketheformsworkforyoubymakingcontrolsinteractwitheachother
andyourdatabase.
ModifyingaControlsPropertiesLetsexamineoneoftheformsthatisalreadyconstructedintheNorthwindsampledatabase,
theEmployeeDetailsform:
Thisformisdesignedtoshowthedetailsofeachemployee.Itfeaturesacomboboxthatallows
youtoswitchbetweenemployees,alogo,atitle,manytextfields,andanattachmentfield(the
picture).
-
8/14/2019 OfficeofInformationTechnology
16/41
Access2007FormsDesign Page16of41
ThisformisbasedupontheEmployeestableinthesampledatabase:
Toseehowtheformisconstructedandtomodifypropertiesoftheform,opentheformin
Designview:
-
8/14/2019 OfficeofInformationTechnology
17/41
Access2007FormsDesign Page17of41
Thecomboboxintheupperlefthandcornerisusedtoswitchfromoneemployeetoanother.
Clickthecombobox(nottheGotolabel)andthenclickthePropertySheetcommandinthe
FormTools Designribbon.ThePropertySheetpanewillappearontherighthandsideofthe
screen:
Thereisnoshortageofpropertiestomodifyforacontrol(infactthereare102different
propertiesyou
can
modify
for
acombo
box!).
We
will
cover
how
to
modify
some
of
these
propertiesaswecontinuewiththislesson.
AtthetopofthePropertySheetisacomboboxyoucanusetoselectacontrolfromthelistof
controlsinthecurrentform.ThePropertySheetalsofeaturessometabsatthetopofthesheet
tobreakdownthelistofcommandsintocategorizedpieces:
FormatTab Controlshowanobjectwilllook.DataTab Performdatamodifications,includingaddingavalidationrule,makinga
defaultvalue,andmodifyingthecontrolsource.
EventTab Controlswhataparticularobjectwilldowhenyouinteractwithit(clickit,movethemouseoverit,etc.).
OtherTab AlternatecontrolslikeallowingAutoCorrectandadjustingthetaborder.AllTab Allcontrolscombined.
-
8/14/2019 OfficeofInformationTechnology
18/41
Access2007FormsDesign Page18of41
YoucanmodifythevaluesinthePropertiesdialogueboxbeenteringavaluedirectly,pickinga
YesorNooption,orselectinganoptionfromacombobox.
ChangingaControlsDataSourceThevastmajorityofformsarebuiltonthedatafromasingletable.InthecaseoftheEmployee
Detailsform,shownintheprevioussectionofthislesson,theformisconstructedfromallthe
datacontainedintheEmployeestable.Eachtextfieldcorrespondstoonefieldinthetable.
Accessmakesitveryeasytochangethecontrolsourceofanobject.First,opentheformin
Designview,clicktheobjectthatyouwanttochangethedatasource,andclicktheProperty
Sheetcommandintheribbon.WhenthePropertySheetpaneappears,clicktheDatatab.
-
8/14/2019 OfficeofInformationTechnology
19/41
Access2007FormsDesign Page19of41
Then,adjusttheControlSourcefieldbyusingthecombobox:
Asthe
form
is
created
from
asingle
table,
all
of
the
available
fields
in
that
table
are
listed
in
the
combobox.TheFirstNamecontrolintheformisbasedontheFirstNamefieldinthetable.
However,youarenotlimitedtousingthefieldsinonetable.Ifyouwanttoaddthevaluesfrom
someotherdatabaseobject,clickthe button.
-
8/14/2019 OfficeofInformationTechnology
20/41
Access2007FormsDesign Page20of41
ThiswillopentheExpressionBuilderdialoguebox:
TheExpressionBuilderletsyoudoanumberofthings.Youcanconstructlogicalexpressions,
extractinformationfromqueries,andcreatecalculations.Inthediagramabove,thenew
controlsourcewouldbethefirstnameofanemployee.Thisapplicationdoesntmakemuch
sense,buttheExpressionBuildermakesiteasytochangethecontrolsourcewithonlyafew
clicks.WewillexploretheuseoftheExpressionBuilderlaterinthismanual.
ChangingaControlsDefaultValueYoumayrecallthetermdefaultvalueusedearlierinthismanualwhenwediscussedtablesin
depth.Adefaultvalueisonethatwillbeautomaticallyfilledinuntilitischangedtosomething
else.
Addingormodifyingadefaultvalueforaformisnodifferentfromchangingthecontrolsdata
source.First,openaforminDesignviewandthenopenthepropertiesofaparticularobject.
-
8/14/2019 OfficeofInformationTechnology
21/41
Access2007FormsDesign Page21of41
TheDefaultValuefieldislocatedundertheDatatab:
Enteradefault
value
for
the
field
or
use
the
Expression
Builder
to
pick
another
value
from
a
table,query,orsomeotherdatabaseobject.
CreatingaCalculatedControlAcalculatecontrolisanobjectinaformthatperformssomesortofcalculationbasedondata
intheformordataextractedfromanothersource.Virtuallyeverycontrolcanbemadeintoa
calculatedcontrol.Considerthefollowingexample:
ThisformtakesthevaluesfromtheSubtotalandShippingtextboxesandaddsthemtogetherin
theTotaltextbox.
-
8/14/2019 OfficeofInformationTechnology
22/41
Access2007FormsDesign Page22of41
Morespecifically,theTotaltextboxcontainsamathematicalexpressionastheControlSource
property.
TheControlSourcefieldhasasimpleexpressionthataddstheSubtotalandShippingfields
togetheranddisplaystheresult.Letsusethisknowledgetomakeabasic(andcompletely
impractical!)calculatorusingAccess.WewillmakeanewforminDesignview,andthenadd
threetextboxes:
-
8/14/2019 OfficeofInformationTechnology
23/41
Access2007FormsDesign Page23of41
OpenthePropertySheetforthefirsttextfieldandclicktheOthertab.Entervalue1asits
Name.
Repeat
for
the
second
and
third
text
boxes,
naming
them
value2
and
total
respectively.
Now,
changetheFormatofeachtextboxtoGeneralNumber(intheFormatTab).ClicktheDatatab
forthetotaltextboxandenter=[value1]+[value2]intotheControlSourcefield.
Nowthatthecalculatorissetup,switchbacktoFormviewandentersomenumbers:
-
8/14/2019 OfficeofInformationTechnology
24/41
Access2007FormsDesign Page24of41
UsingFormPropertiesInFormDesignview,weknowthatclickingthePropertySheetcommandwilldisplaythe
propertiesforaselectedobject.Thecomboboxatthetopofthesheetletsyouviewthe
propertiesof
each
active
object
in
the
form,
as
well
as
the
Form
itself:
Therearealmost120propertiesthatcanbemodifiedinaform.Themajorityoftheproperties
youcanmodifygobeyondthescopeofthismanual,butAccessoffersmanyexamplesof
differentsettingsinitshelpfile.Beitatable,form,query,orreportproperty,whenyourcursor
isinsideapropertybox,pressF1onthekeyboardtoreaddetailsaboutthatspecificproperty
andhow
it
relates
to
the
parent
object.
-
8/14/2019 OfficeofInformationTechnology
25/41
Access2007FormsDesign Page25of41
FormattingYourFormWehaveseenhowtoadjustthepropertiesofthecontrolsinaform.Inthislessonwewill
exploreafewmoreusefuloptionsandcustomizablefeaturesofforms.
FormattingGridlinesIfyouhavetriedtomoveacontrolusingyourmouse,youhavenodoubtbecomealittle
frustratedtryingtogeteverythinglinedupneatly.Fortunately,Accessgivesyoutheabilityto
usethegridlayoutthatisvisibleinformDesignview:
Thesolidblacklinesaredefinedasa1grid.Youcanmodifytheresolutionofthedotmatrix
visibleinDesignview.Tomodifythissetting,openthePropertySheetfortheformordouble
clicktheformselectorbuttonwhileinDesignview:
ClicktheFormattabinthePropertieswindowandscrolldownuntilyoucanseetheGridXand
GridYproperties:
-
8/14/2019 OfficeofInformationTechnology
26/41
Access2007FormsDesign Page26of41
Thenumbersineachfielddenotehowmuchyoucansubdividethe1squaregridvisiblein
Designview.Thedefaultvalueis24,meaningthatthespacebetweenthedotsis1/24th
ofan
inch.Youcanadjustthesepropertiesfrom1to64.Bothvaluescanbeadjustedindependently,
thoughit
is
agood
idea
to
keep
both
values
either
the
same
or
multiples
of
each
other.
Changingthevaluesto12foreachfielddecreasestheresolutionbyhalf:
If
you
want
to
turn
off
the
gridlines
completely,
click
the
Show
Grid
command
in
the
Form
Tools
Arrangeribbon:
ModifyingtheFontFontscaneasilybechangedatanytimeineitherDesignorLayoutview.Simplyclicktheform
objectyouwanttomodifyandusetheFontsectionoftheFormTools Designribbon:
-
8/14/2019 OfficeofInformationTechnology
27/41
Access2007FormsDesign Page27of41
Youcan
change
the
font,
size,
style,
orientation,
and
color
with
these
commands.
But
imagine
youhaveaverylargeformwithseveralfieldsyouwanttomodifyatonce,suchasthe
EmployeeDetailsform:
ApplytheformattingyouwishtousefortheformtoasinglecontrolinDesignview:
-
8/14/2019 OfficeofInformationTechnology
28/41
-
8/14/2019 OfficeofInformationTechnology
29/41
-
8/14/2019 OfficeofInformationTechnology
30/41
Access2007FormsDesign Page30of41
UsingLayoutview,alongwithothertechniquessuchaschangingtheresolutionofthe
formattinggrid,letsyoucreateaformexactlytoyourliking.Ifyoudontlikeacertainchange
youmade,pressCtrl+Zonyourkeyboardtoundotheoperation.
FormattingControlsInthislessonwewillcoverafewmorecommandsthatareavailablewhenworkingwithaform.
ChangingtheColorofaControlThelookandfeelofnearlyeverycontrolcanbemodifiedinsomewaybymakinguseofthe
FormTools Designribbon.Considerthefollowingform,completewithafewdifferent
controls:
-
8/14/2019 OfficeofInformationTechnology
31/41
Access2007FormsDesign Page31of41
TheonlyoneofthecontrolsthatcannotbemodifiedarethetabsoftheTabControlobject
(withPage8andPage9asthetabs).Anythinginsidethetabscan,however,bemodified.
TheLineobjectcanhaveathickness,astyle,andacolor,asdefinedintheControlssectionof
theribbon:
AnyoftheothercontrolsthatincludetextofsomesortcanbemodifiedbyusingtheFont
sectionoftheribbon:
UsingControlPropertiesConsiderthecheckboxinthefollowingdiagram:
Itconsistsoftwodifferentobjects;thecheckboxitselfandalabel.Eachobjecthasitsownset
ofindividualproperties.Toviewthepropertiesofthisoranyobject,selecttheobjectandclick
thePropertySheetcommandintheribbon.Propertiesaremodifiablebyusingacombobox,
enteringavaluebyhand,andoccasionallyusingthe icontoopenaWizardorexternal
resourceinordertosetaproperty.Wewillusethecheckboxitselfasanexample.
FormatTab Modifyhowthecontrolwillappearintheformincludinghowwidetheborderaroundthecheckboxwillbe,whatsortofstylethecheckboxwill
have,thecoloroftheborder,andhowmuchspaceisaroundthecheck
box.
DataTab Acheckboxcanhaveacontrolsource(suchasaBooleanortrue/false)fromatable,avalidationrule,whethertheoptionisenabledand/or
locked,andevenifyouwouldliketohaveatriplestatecheckbox(one
thatiseithertrue,false,ornull.)
EventTab Controlswhatthecheckboxwilldowhenitisinteractedwith.Thisincludeswhatwillhappenifthemouseismovedontop,isclicked,is
-
8/14/2019 OfficeofInformationTechnology
32/41
-
8/14/2019 OfficeofInformationTechnology
33/41
Access2007FormsDesign Page33of41
Thiswillalignallcontrolstothebottomofthelowestcontrolintheform:
ClickingtheToWidestcommandexpandsallcontrolstothesamewidthasthewidestone
currentlyselected:
-
8/14/2019 OfficeofInformationTechnology
34/41
Access2007FormsDesign Page34of41
FormattingRecordsInthefinallessononforms,wewillcoverthelastofthecommandsandfunctionalityavailable
for
use.
ModifyingFontsRegardlessofifyouareinLayoutorDesignview,youalwayshavetheabilitytochangethefont
quicklyandeasily.UsetheFontsectionoftheHomeribbon(whichisalwaysaccessible),the
FormTools FormattingribbonwhileinLayoutview,andtheFormTools Designribbonwhen
inDesignview.
UsingAutoFormatWhenyoufirstbeginmakingforms,youwilllikelyusetheformWizardtogetyoustarted.
However,theWizardmaynotprovidethefunctionalityyouneed.Designingformsbyhandisa
bitmoretimeconsuming,andsometimesmakingaformlookabitpresentablegetspushed
downthelistofimportance.Luckily,Accessfeaturesformattingcolorschemesthatcanbe
appliedanytimebefore,during,orafterthecreationofaform.
ConsidertheEmployeeDetailsformfromtheNorthwindsampledatabase:
-
8/14/2019 OfficeofInformationTechnology
35/41
Access2007FormsDesign Page35of41
Thelinksatthetopofthepagehaveacertainlook,thelabelseachhavetheirownfontsizeand
color,andthetextboxesareallbrightandeasytoread.
However,iftheformwascurrentlyunformatted,orifyoudidntlikethelookoftheform,you
canusetheAutoFormatcommandtoapplyaformattingchange.
-
8/14/2019 OfficeofInformationTechnology
36/41
Access2007FormsDesign Page36of41
OpentheforminDesignview,andthenclickthepulldownarrowunderneaththeAutoFormat
commandintheFormTools Arrangeribbon:
Chooseanyofthe25predefinedformatstoapplytoyourform:
-
8/14/2019 OfficeofInformationTechnology
37/41
Access2007FormsDesign Page37of41
Accessalsogivesyoutheabilitytocustomizeaparticularformat.ClicktheAutoFormatWizard
buttonatthebottomoftheAutoFormatpulldownmenutoopentheAutoFormatdialogue
box:
Then,clicktheCustomizeb
Using the Format Ribbon
uttonontherighthandsidetomodifythespecificsofatemplate.
TheFormatribbonisvisiblewhenviewingaforminLayoutview.Letsexaminewhateach
sectionoftheribbonisusedfor:
Views Usethispulldowncommandtoswitchbetweendifferentviewsintheform:
Font Thissectionisusedtomodifythefontandstyleoftext.TheConditionalcommandisusedtoapplydifferentformattingstyles
accordingtocertainscenarios.Forexample,ifyouarecalculating
-
8/14/2019 OfficeofInformationTechnology
38/41
Access2007FormsDesign Page38of41
monetaryfigures,allpositivevaluescanbeboldandblackwhileall
negativevaluescanbehighlightedinred.
Formatting Theformattingsectionisusedtoapplyadifferenttextstyletocertainnumericaldata.Forexample,clickingthe$commandwill
formatanumbertolooklikecurrency.
Gridlines Ifyoucreateaformbaseduponanexistingtable,allofthefieldsintheformareconstructedasatable.Usethecommandsinthis
sectiontochangethelookofthedividinglinesinthetableorgrid.
Controls Thecontrolssectionletsyouaddotherfieldstothetable,addalogo,title,dateandtime,aswellasmodifythelookofanylinesor
rectanglesyourformmayalreadycontain.
-
8/14/2019 OfficeofInformationTechnology
39/41
Access2007FormsDesign Page39of41
AutoFormat Clicktheupanddownarrowsontherighthandsideofthesectiontoscrollthroughtheavailableformats.Clickthepulldownarrowto
displayallavailableformatoptions.
UsingtheArrangeRibbonInLayoutview,theLayoutribboncontainsthebasiccontrolsneededtoadjustthepositionof
theobjectsintheform:
ControlLayout Thissectionallowsyoutomoveacontrolorgroupofcontrolsaroundtheform,setmarginsoffreespacearoundcontrols,andset
thetaborderofthedifferentcontrols.
ControlAlignment Thissectionallowsyoutolineuptwoormorecommandssothatthey
are
all
as
left
as
the
leftmost,
as
right
as
the
rightmost,
or
as
highorlowasthehighestorlowestcommandintheselected
group.Thesecommandsareveryusefulwhenbuildingaformby
handandkeepingeverythingneatandtidy.
Position Thesecommandsdealwithhowobjectsinyourformrelatetoeachother
in
position.
The
Anchoring
command
allows
you
to
pin
a
controltotheformortoanothercontrolsuchthatiftheparent
controlshouldbechanged,thepinnedcontrolisformattedinthe
sameway.Othercontrolsinvolvemovingcontrolsasiftheywerein
layers,whereonecontrolisconcealedorontopofanother.
-
8/14/2019 OfficeofInformationTechnology
40/41
Access2007FormsDesign Page40of41
Tools Thissectioncontainsthecommandtoopenthepropertiesrelatingtothecurrentlyselectedobject.
-
8/14/2019 OfficeofInformationTechnology
41/41
Access2007FormsDesign Page41of41
ExpressionBuilder................................................................................................................... 20,21
FormatPainter.............................................................................................................................. 28
Forms
Addingcontrols........................................................................................................................... 5
Addinglogo
to
...........................................................................................................................
28
Aligningcontrols....................................................................................................................... 32
Andgridlines............................................................................................................................. 25
Arrangeribbon........................................................................................................ 26,32,36,39
AutoFormat............................................................................................................................... 34
Calculatedcontrols................................................................................................................... 21
Controloverview......................................................................................................................... 6
Controlproperties............................................................................................................... 15,31
Controlwizard............................................................................................................................. 9
Controlsdefaultvalue.............................................................................................................. 20
Designribbon...............................................................................................14, 17,26,28,30,34
Editingcontrolsin..................................................................................................................... 10
Formattingcontrols............................................................................................................ 14,30
Formattingribbon..................................................................................................................... 37
Modifyingacontrolsdatasource............................................................................................ 18
Properties.................................................................................................................................. 24
Typesof....................................................................................................................................... 3
Whatare?.................................................................................................................................... 3
PDF.................................................................................................................................................. 8
Ribbons
Create...................................................................................................................................... 3,4
Home...............................................................................................................................
5,
14,
34
Tables
Defaultvalue....................................................................................................................... 17,26