Professional Documents
Culture Documents
Anatom y of a For m
The Object's Tab
Rem em ber t hat , w hen displaying dat a t o a user, t he form show s in Form View, if you are designing, or m odifying t he design of, a form , you m ust display it in Design View. I n som e case, whet her in For m View or in Design View, a form is repr esent ed by a t ab t hat displays an icon .
Pr actical Lear ning: I ntr oducing For m s and Repor ts' Pr oper ties
1. St art Micr osoft Access and open t he H ot e l M a n a ge m e nt 1 dat abase you st art ed in t he pr evious lesson 2. To creat e a new for m , on t he ribbon, click Cr eat e and, in t he Form s sect ion, click Blank For m 3. To save t he new form , right - click t he Form 1 t ab and click Save 4. Set t he nam e t o Ce n t r a l and press Ent er 5. To swit ch t he form t o Design View, on t he r ight side of t he st at us bar, click t he Design View but t on 6. To access t he proper t ies of t he form , doubleclick t he but t on at t he int ersect ion of t he r uler s
Aft er m aking t he select ion, you can click OK. You will be asked t o close and reopen t he dat abase:
The gr oup of t hese but t ons is called t he Con t r ol Box . I f you do not want t hese syst em but t ons at all, access t he Proper t ies window of t he form and set t he Con t r ol Box Boolean proper t y t o N o from it s Ye s default value. I n t his case, t he for m w ould appear w it h neit her t he syst em icon nor t he syst em but t ons. I f you do t his, m ake sur e t he user has a way t o close t he for m .
Available The form can only be closed Available The form can be m inim ized or closed but not m axim ized The form cannot be
Disabled Enabled
Enabled Enabled
Available
All oper at ions ( m inim ize, Available m axim ize, rest or e, and close) are allow ed
Depending on t he role and pr obably t he num ber of Windows cont rols on a for m , you will decide w hat but t on t o allow or not .
For m Layout
The m ain area of t he for m is w hat t he user will m ost ly use. This is also r efer red t o as t he body of t he form . I f you creat e a for m using t he Form Wizar d , it ( t he w izard) can assist you w it h deciding how t he obj ect s in t he body of t he for m would display. Form s can be designed in various flavors: Colum n a r , D a t a she e t , Tabu la r , Ju st ifie d :
A colum nar for m is used t o display dat a one recor d at a t im e. This is a convenient display for dat a ent ry and analysis because t he user is able t o exam ine each piece of inform at ion for each one r ecor d:
A t abular form displays it s dat a in a ser ies of cells follow ing cont inuous set s of records. All or alm ost all r ecor ds are displaying in a single layout :
To creat e a t abular form , use t he Form Wizar d and select it s opt ion. Ot her wise, you can design a fr om fr om scr at ch. Then, in t he For m at or t he All t abs of t he Proper t ies window , set it s D e fa ult Vie w t o Con t in u ous For m
A Dat asheet for m looks and behaves like a t able, displaying all possible r ecor ds at t he sam e t im e inst ead of one record at a t im e. A dat asheet form is m ainly used in relat ionships t o display anot her t able's relat ed records. I t is also suit able for people w ho prefer t o wor k in a spreadsheet envir onm ent . This display allows t he dat abase developer t o provide a sheet view t o t he dat a ent ry personnel wit hout m aking t he t able's design or form at s available. You can m ake t he sam e form available in Form View and Dat asheet View . I n fact , m ost form s ar e. User s can sw it ch from Form View t o Dat asheet View by clicking t he View m enu. To creat e a Dat asheet form , use t he For m Wizard and select it s opt ion. You can also design a from from scrat ch. Then, in t he For m at or t he All t abs of t he Propert ies w indow , set it s Default View t o Dat asheet
A Just ified for m provides a consist ent look w it h bor ders added t o labels A split form is m ade of t wo sect ions. The t op sect ion displays like a norm al Form View and show s one r ecord at a t im e. The bot t om sect ion displays a dat asheet view of ( all) t he r ecor ds ( if t he area is big enough) :
When using t he split for m , if you click a record in t he bot t om sect ion, it s values display in t he t op sect ion.
To aut om at ically gener at e a split form , in t he Navigat ion Pane, click t he t able t hat holds t he records. Then, on t he Ribbon, click Cr eat e. I n t he For m s sect ion, click Split Form . To cr eat e a split for m by design, st ar t a for m in Design View or display an exist ing for m in Design View . I n t he Propert ies w indow of t he form , set it s Recor d Source t o t he t able t hat holds t he value and set it s Default Value t o Split Form . I f it is bran new form wit hout som e previously cr eat ed fields, use t he Field List t o add t he desir ed fields t o it .
Right - click t he m iddle of t he for m and click For m H e a de r / Foot e r On t he ribbon, you can click Arrange and, in t he Show / Hide sect ion, click t he For m H e a de r / Foot e r but t on
Any of t hese t wo act ions w ould add t wo new sect ions t o t he for m : t he For m Header sect ion on t op and t he Form Foot er sect ion at t he bot t om :
Alt hough t w o sect ions are added, you can reduce one com plet ely so it w ould not appear t o t he user . This m eans t hat you can keep one sect ion and hide t he ot her. I f you creat e a form using t he For m Wizard, bot h t he header and t he foot er sect ions are added but t he foot er sect ion is com plet ely reduced so it would not appear t o t he user. I f you want t o display it t o t he user , you m ust expand it .
Right - click t he m iddle of t he for m and click Pa ge H e ade r / Foot e r I n t he Show/ Hide sect ion of t he Ar range t ab of t he ribbon, you can click t he Pa ge H e a de r / Foot e r but t on
Any of t hese act ions w ould add t w o new sect ions t o t he for m : a Pa ge H ea de r and a For m H ea de r sect ions. These sect ions would not appear t o t he user. They appear only if t he user decides t o print a form , in w hich case t hey w ould appear on t he pr int ed paper. Like t he form sect ions, you can use eit her one or bot h t he Pa ge H e a de r and t he Pa ge Foot e r sect ions
D ividing Lines
A for m is equipped w it h special horizont al lines used t o visually separ at e sect ions of a for m . They do not per for m any ot her special act ion. To equip a for m w it h dividing lines, add a header and a foot er sect ions. I f you creat e a form t hat is direct ly equipped wit h a header and a foot er sect ions, it w ould display t he dividing lines. The presence or absence of t he horizont al lines is cont rolled by t he Boolean D ividin g Lin e s propert y. I f you set it s value t o Yes , t he dividing hor izont al lines would display on t he form . To hide bot h lines, you can set t his pr opert ies value t o N o . To hide an individual line, you can com plet ely r educe it s sect ion.
By default , scroll bars com e up if t he form "j udges" t hem necessar y, such as if som e fields, or som e ar ea of som e fields, ar e hidden. The pr esence of scr oll bar s allow s t he user t o be aware of hidden fields. Depending on your design, you can cont r ol t he appearance or disappearance of t he scroll bars. To do t his, change t he values of t he Scroll Ba r s field in t he For m at pr opert y page. Ther e ar e four possible values. To display only t he vert ical scroll bar, set t he value t o Ve r t ica l Only :
I n t he sam e w ay, you can display only t he horizont al scr oll bar by select ing H or izon t a l Only . On t he ot her hand, you can display bot h scroll bars by set t ing t he value t o Bot h . I f for som e reason you do not want any scr oll bar, set t he Scr oll Ba r s proper t y value t o N e it he r .
On a dat asheet form , a t abular form , or t he dat asheet sect ion of a split form , t he r ecor d select or is t he box on t he left side of each individual record. This m eans t hat t he view of t he form can display m any r ecord select ors, one for each record. I n t he following scr eenshot , t he record select or of each r ecor d is t he blue box on it s left :
I f you do not want a form t o display t he record select or( s) , in it s Design View, set it s Re cor d Se le ct or s pr opert y t o N o .
N avigation Buttons
I n t he bot t om sect ion, a form is equipped wit h t he sam e navigat ion but t ons used on t ables. These but t ons ar e useful only if t he form is m eant t o display dat a. The but t ons ar e available if t he for m is displayed in a view ot her t han t he Design View . I f you do not w ant a form t o display t he navigat ion but t ons, set it s N a viga t ion But t ons propert y t o N o .
N avigation Caption
By default , a for m is equipped w it h a st at us bar or navigat ion bar. On t he left side of t he bar, it displays t he Re cor d: label. I f you want , you can change t hat st ring t o a short one of your choice. To change t he t ext on t he left side of t he navigat ion bar , in t he Proper t ies window of t he form , click t he For m at t ab and, in t he N a v iga t ion Ca pt ion field, ent er a st r ing of your choice. Here is an exam ple of a result ( not ice t he Navigat ion st ring on t he lower - left side of t he bot t om bar) :
You can t hen click and dr ag right t o widen or left t o nar row t he form . The widt h of a form is a num eric value. To change it s value w it h m ore precision, access t he Proper t ies window of t he form . I n eit her t he Form at or t he All t ab, click t he W idt h field, t ype a decim al value and pr ess Ent er.
1. Double- click t he but t on at t he int er sect ion of t he ruler s. I n t he Form at t ab of t he Proper t ies window , click W idt h 2. Type 4 .5 and pr ess Ent er
The height is a num eric value. As m ent ioned already, each sect ion of a for m cont rols it s ow n height . Based on t his, t o num erically change t he height of a sect ion of a form , access t he Proper t ies w indow of t hat sect ion. I n eit her t he For m at or t he All t ab, click t he H e igh t field, t ype a decim al value and press Ent er . This also m eans t hat , t o set t he t ot al height of a for m , you can change t he H e igh t value of each sect ion.
You can t hen click and dr ag left , r ight , up, dow n, or diagonally. To num erically change t he w idt h and t he height of a form , change t he value of t he Widt h of t he form . Then change t he Height values of t he individual sect ions.
When you pr eview t he form , it would appear w it h t he expanded size, which is not t he act ual size of t he form . The above form w ould pr oduce:
When t he for m is previewed, t o get it s act ual size, on t he r ibbon, click Hom e. I n t he Window
Obviously before using a pict ur e, you should design or be very fam iliar w it h it . This is because you m ay want one sam ple of t he pict ure t o cover t he whole form . Here is an exam ple:
I f you set t he Pict ur e Type t o Lin k ed , t he file nam e of t he pict ure ( w it h it s ext ension) w ould be set as t he value of t he Pict u r e proper t y I f you set t he Pict ur e Type t o Em bedded, you w ould be asked t o first r em ove t he value of t he Pict u r e proper t y. You m ust specify t he pict ure again. This t im e, t he ( whole) pat h of t he file nam e would be set as t he value of t he Pict ur e pr opert y.
I f you use a pict ur e t hat is sm aller t han t he for m , by default , t he pict ure w ould be posit ioned in t he m iddle of t he form . This char act erist ic is cont rolled by t he Boolean Pict u r e Align m e nt propert y w hose default value is Cent er . I f you want t he sm aller pict ur e t o be posit ioned in one of t he sect ions, select anot her value fr om t his propert y. I f you select :
Top Le f t : I f t he form has only a Det ail sect ion, t he pict ure w ould be posit ioned from under t he Form Header bar but t o t he left side of t he sect ion. I f t he pict ure is t aller t han t he Form Header sect ion, it w ould span dow n t o t he Det ail sect ion
I f you want such a pict ure t o display only in t he Form Header sect ion, when designing it , m ake it shor t er and set t he height of t he For m Header sect ion accordingly
Top Righ t : I f t he form has only a Det ail sect ion, t he pict ur e w ould be posit ioned from under t he For m Header bar but t o t he right side of t he sect ion.
I f t he pict ure is t aller t han t he Form Header sect ion, it w ould span dow n t o t he Det ail sect ion. I f you want such a pict ure t o display only in t he For m Header sect ion, w hen designing it , m ake it as t all as t he int ended height of t he For m Header sect ion
Cen t e r a nd For m Ce nt er : The pict ure would be posit ioned in t he m iddle of t he Det ail sect ion Bot t om Le ft : I f t he for m has only a Det ail sect ion, t he pict ure would be posit ioned above t he Form Foot er bar t o t he left side of t he sect ion. I f t he pict ure is t aller t han t he Form Header sect ion, it w ould span up t o t he Det ail sect ion
I f you want such a pict ure t o display only in t he Form Foot er sect ion, design it and m ake it as t all as t he event ual height of t he For m Header sect ion
Bot t om Right : I f t he for m has only a Det ail sect ion, t he pict ure would be posit ioned above t he Form Foot er bar t o t he r ight side. I f t he pict ure is t aller t han t he Form Header sect ion, it w ould span up t o t he Det ail sect ion. I f you want t he pict ure t o display only in t he Form Foot er sect ion, when designing it , m ake it as t all as t he height you will specify for t he For m Header sect ion
3. Close t he form
charact er ist ic is refer red t o as t iling. To m ake t his happen, in t he For m at or t he All t ab of t he Proper t ies w indow, set t he Pict u r e Tiling Boolean propert y t o Ye s . Consider t he following exam ple:
Clip : This is t he default value. I t s effect depends on t he Pict ure Alignm ent and t he Pict ur e Tiling proper t ies St r e t ch : When t his opt ion is select ed, t he pict ure size would be expanded so t hat it s corners ( t op- left , t op- right , bot t om - r ight , and bot t om - left ) t ouch t he cor ner s of t he form . Here is an exam ple:
I f t he form is resized, t he backgr ound pict ur e would be st ret ched so it s corners are t he sam e as t hose of t he for m . Her e is an exam ple of t he above for m resized:
St r e t ch H or izon t a l : When t his opt ion is select ed, t he pict ure would be expanded horizont ally so t hat it s left border t ouches t he left border of t he form and t he r ight border of t he pict ure w ould t ouch t he r ight border of t he for m . I f t he for m is r esized, t he backgr ound pict ure w ould be st ret ched also. I t s left and right bor ders w ould st ill t ouch t he left and r ight borders of t he form St r e t ch Ve r t ica l : I f t his value is set , t he pict ur e w ould be height ened or short ened so it s t op border t ouches t he t op border of t he for m and t he bot t om bor der of t he pict ur e would t ouch t he bot t om border of t he for m . I f t he for m is r esized, t he pict ur e w ould be st ret ched also: it s t op and bot t om borders would cor respond t o t he t op and t he bot t om borders of t he form Zoom : To st art , Micr osoft Access would get t he height and t he widt h of t he pict ure, t hen it w ould calculat e t heir rat e t o get a fr act ion such as 1/ 2, or 3/ 4, or 7/ 5, et c. When t his opt ion is select ed, t he pict ure would be st r et ched propor t ionally using t he calculat ed r at e. When st ret ching, once a border of a pict ur e r eaches a border of t he for m , t he ot her border w ould not be st r et ched anym or e. As a consequence, if t he r at e of t he dim ensions of t he form is not t he sam e as t he rat e of t he dim ensions of t he pict ur e, t wo sides of t he for m would not be covered. Consider t he following:
Not ice t hat t he pict ure is squar e, which m eans t he rat e of it s height and widt h is 1. The form is rect angular, w hich m eans t he rat e of it s height and w idt h is differ ent t han 1. I f you set t he Pict u r e Size M ode proper t y t o Zoom , you w ould get t he following result :
I f you resize t he form , t he pict ure also m ay be st ret ched but it w ould keep t he r at e of it s height / widt h.
On t he ribbon, click Hom e and, in t he Font sect ion, select a color fr om t he Fill/ Ba ck Color but t on Right - click a sect ion, posit ion t he m ouse on Fill/ Back Color and click t he desired color
On t he ribbon, click Design and, in t he Font sect ion, select a color from t he Fill/ Ba ck Color but t on Access t he Proper t ies window of t he sect ion. I n t he For m at or t he All t ab, click t he Ba ck Color field. I f you click t he arr ow of t he propert y, you can select a fam iliar color from t he list . Ot herw ise, you can click t he br owse but t on. This w ould display a list of colors sim ilar t o t hat of t he Fon t / For e Color w indow
Unlike t he Fill/ Ba ck Color ( and t he Font Color ) of t he Font sect ions of t he Hom e and t he Design cat egor ies of t he ribbon, when you right - click a sect ion of a form and posit ion t he m ouse on Fill/ Ba ck Color , t he color s t hat display do not show t heir t ool t ip, w hich would indicat e t heir nam es. Because t he layout of colors is t he sam e as t he Fill/ Ba ck Color and t he Font Color window s of t he Font sect ions of t he Hom e and t he Design cat egories of he ribbon, w e w ill use t heir nam es.
I n t he Font sect ion, click t he arrow of t he Fill/ Back Color but t on 5 ( 4t h colum n - 6t h row )
3. On t he for m , right - click under t he Det ail bar, posit ion t he m ouse on Fill/ Back Color and click Medium Gray 2 ( 3r d colum n - 3rd row) 4. On t he for m , double- click t he sect ion under t he For m Foot er bar 5. I n t he Proper t ies window , click t he Form at bar and click Back Color 6. Click t he arrow of t he field and select Background Form 7. To save t he for m , press Ct rl + S
Special Effects
Micr osoft Access pr ovides som e special visual effect s used t o r aise or sink, et c a sect ion of a form or r eport , a label or a field. These effect s can be cont r olled by using t he Spe cia l Effect field in t he Proper t ies window .
Use t he Form Wizard t o creat e t he form and select a design on t he t hir d page of t he w izar d
I f t he form has been creat ed alr eady, open or display it in Design View. On t he r ibbon, click Ar range. I n t he Aut oFor m at sect ion, click t he Aut oForm at but t on. This w ould display a w indow w it h t he available form at s
Each form at has a nam e t hat appears as a t ool t ip w hen you posit ion t he m ouse on it . To apply one of t he for m at s t o your form , sim ply click it . You can also click t he Aut oForm at Wizar d... but t on and, in t he dialog box, select t he desired design
Display t he form in Layout View. To do t his, in t he Navigat ion Pane, you can right - click t he form and click Layout View. I f t he for m is cur rent ly opened, on t he right side of t he st at us bar, you can click t he Layout View but t on. Once in t he Form Layout View , in t he Aut oForm at sect ion, click one of t he but t ons in t he left sect ion. I f you click t he More but t on, a w indow w ould com e up and would display a window w it h t he pr eview. I f you see a for m at you w ant , you can click it . I f you click t he More but t on, you can t hen click t he Aut oForm at Wizard... but t on and, in t he dialog box, select t he desired design
Open or display t he form in Design View . On t he r ibbon, click Arr ange. I n t he Aut oFor m at sect ion, click t he Aut oFor m at but t on and, in t he w indow t hat appear s, click t he Aut oForm at Wizard but t on...
I n t he Aut oForm at dialog box, you can click t he Cust om ize... but t on.
Display t he form in Layout View and, in t he Aut oForm at sect ion of t he Form at cat egory of t he ribbon, click t he More but t on, click Aut oFor m at , and click Cust om ize...
I n t he Cust om ize Aut oFor m at dialog box, you can click t he Creat e A New Aut oFor m at Based
D ialog Boxes
I ntr oduction
A dialog box is a rect angular obj ect t hat is used t o host or car ry ot her cont rols:
A dialog box is prim arily char act erized by t wo feat ures: it s t it le bar and it s body. The t it le bar, on t op of t he dialog box, can have a t it le and has t he syst em close but t on . Alt hough t his is t he norm al appearance of a dialog box, it is not st r ict ly exclusive. Som e dialog boxes display t he syst em icon. On t he r ight side of t he t it le bar , a classic dialog box displays only t he syst em Close but t on m ade of X. Again, t his is not exclusive. I t is not unusual for a dialog box t o display t he m inim ize and t he m axim ize/ rest or e but t ons. To use a dialog box, t he user m ust open it one w ay or anot her. Your j ob is t o decide how and when t he user w ill be able t o open a dialog box.
To let t he applicat ion gener at e a dialog box for you, on t he Ribbon, click Creat e. I n t he For m s sect ion, click More Form s - > Modal Dialog To creat e t he dialog box yourself, st art a form in Design View . To convert an exist ing form int o a dialog box, set it s Bor de r St yle pr opert y value t o D ia log . This reduces t he syst em but t ons t o t he Close but t on only
9. To com plet e t he dialog box, in t he Form at t ab of t he Propert ies window , change t he follow ing pr opert ies: Au t o Cen t e r : Yes Recor d Se lect or s = N o N a viga t ion But t on s = N o 10. Click t he Det ail bar t o select it . Then, in t he Form at t ab of t he Proper t ies window , click Height . Type 1.875 and press Ent er 11. Preview and save t he form 12. Sw it ch it back t o Design View
Lesson Sum m ar y
M CAS: U sing M icr osoft Office Access 20 0 7 Topics
C5 C7 E2 Creat e form s Modify t he design of repor t s and form s Navigat e am ong records
W atts A loan
1. Open t he Wat t s A Loan1 dat abase 2. Configur e t he dat abase t o display in over lapping window s