Você está na página 1de 12

Data Controls

A Label
I ntr oduction
A label is a cont r ol t hat ser ves as a guide t o t he user . I t pr ovides a st at ic t ext t hat t he user cannot change but can r ead t o get infor m at ion about anot her cont r ol on t he form or r epor t . You can also use it t o display sim ple infor m at ion t o t he user . Most cont r ols on t he for m or t he repor t ar e not explicit at fir st glance and t he user w ould not know w hat t hey are. Therefor e, you can assign a label t o t he cont r ol as a help t o t he user . To add a label t o a for m or r eport , in t he Cont r ols

sect ion of t he Ribbon, click Label and click on t he for m or r epor t . Type t he t ext t hat t he label will display and press Ent er ( as we w ill see, m ost cont rols add t heir ow n label t o t he form or report ) .

Pr actical Lear ning: I ntr oducing D ata Contr ols


1. St ar t Micr osoft Access and open t he Red Oak High School dat abase you cr eat ed in Lesson 5 2. On t he Ribbon, click Creat e and, in t he Form s sect ion, click For m Design 3. I n t he Pr opert ies w indow , click t he Dat a t ab and set t he Record Sour ce t o St udent s 4. Save t he form as St ude nt s and close it

Pr oper ties of a Label


Probably t he m ost im por t ant and t he m ost obvious char act er ist ic of a label is t he t ext it is displaying. The t ext is t he label's capt ion. I f you click t he Label cont r ol on t he Ribbon and click t he for m or r epor t , you m ust first define it s capt ion. I f a label already has a capt ion, t here are various w ays you can edit it . For exam ple, you can double- click it t o access it s Proper t ies w indow and edit t he st ring in t he Capt ion field. On t he ot her hand, t o edit t he capt ion of a label, on t he for m or r eport , click inside t he label. That would put it int o edit m ode and you can edit it as you w ish. The appearance of a label is visibly cont rolled by it s font char act erist ics. The Font nam e, also called it s face, is t he nam e of t he font as defined by t he oper at ing syst em . We saw t hat t here are var ious w ays you can define t he font char act er ist ics of a cont rol like t he label. The size of a label cont rol it s W idt h and it s H e ight . Alt hough t he dim ensions ar e closely r elat ed t o t he font char act erist ics, t hey can be independent ly defined. Ther e ar e t wo m ain w ays you can r esize a label, w hich is equivalent t o changing it s size. To set your own size, in t he For m at t ab of t he Pr oper t ies w indow of t he label, change t he values of t he W idt h and H e ight pr opert ies. Unless you plan t o show t he backgr ound color of a label, pr obably t he best w ay t o r esize a label is t o m ake it adj ust t o t he dim ensions depending on t he font size and t he t ot al charact er s widt h. To do t his, posit ion t he m ouse on one of t he label's handle and double - click. The label's widt h and height w ould be set t o accom m odat e it s capt ion. The posit ion of a label is cont r olled by it s Top and Le ft pr opert ies. The Top proper t y defines t he m easur e from t he t op left cor ner of t he sect ion wher e t he label is posit ioned, t o t he t op left cor ner of t he label it self.

Pr actical Lear ning: D esigning Labels


1. Fr om t he resources t hat accom pany t hese lessons, open t he Bet hesda Car Rent al1 dat abase 2. On t he Ribbon, click Creat e and, in t he Form s sect ion, click For m Design

3. Right - click t he form and click For m Header/ Foot er

4. I n t he Cont r ols sect ion of t he Ribbon, click Label t he Header bar 5. Type Be t h e sda Ca r Re nt a l - Asse t s and pr ess Ent er

and click t he t op- left sect ion under

6. While t he new label is st ill select ed, in t he Font sect ion of t he Ribbon, click t he ar r ow of t he Font com bo box and select Ga r a m ond 7. Click t he ar r ow of t he Font Size com bo box and select 2 4 8. Click t he Bold but t on 9. Click t he ar r ow of t he Font Color but t on and click Yellow ( St andar d Color s: 4t h colum n 4 7t h r ow ) . 10. To r esize t he label, posit ion t he m ouse on one of t he handles sur rounding t he label and double- click

11. Click t he Form Header bar . I n t he Font sect ion of t he Ribbon, click t he ar r ow of t he Fill/ Back Color and select Dar k Red ( St andard Colors: 1st colum n - 7t h r ow) 12. Click t he Det ail bar . I n t he Font sect ion of t he Ribbon, click t he ar r ow of t he Fill/ Back Color and select Backgr ound ( Access Them e Color s: 5t h colum n - 1st r ow) 13. Save t he form as Asse t s

A Title
I ntr oduction
I n our int roduct ion t o t he label cont r ol, we lear ned t o add a st r ing t o a for m . To m ake it act as t he t it le of t he for m , we had put it in t he header sect ion. We also had t o r em em ber t he nam e of t he for m t o apply it t o t he label. Microsoft Access pr ovides a fast er m eans of cr eat ing a t it le. This is done using t he Tit le cont r ol. When you do, Micr osoft Access r et rieves t he nam e of t he for m , creat es a label, and uses t he nam e of t he for m as capt ion.

Cr eating a Title
I nst ead of going t hrough t he label t o get a t it le, t o form ally cr eat e a t it le, in t he Cont r ols sect ion of t he Ribbon, click t he Tit le cont rol and click t he for m . When you click t he for m , if it did not have a for m header sect ion, t hat sect ion w ould added t o t he form . I f it had t he sect ion, t hat sect ion would be used. Then, a new label wit h t he nam e of t he for m as capt ion w ould be added t o t he for m header sect ion. When creat ing t his label, Micr osoft Access w ould use som e default charact er ist ics, such as t he font nam e and size, and applied t hem t o t he label. Of cour se, you can change any of t he char act erist ics, including t he capt ion of t he t it le.

Pr actical Lear ning: Adding a Title


1. Re- open t he Red Oak High School dat abase 2. I n t he Navigat ion Pane, under St udent s: Table, r ight - click t he St udent s form and click Design View 3. I n t he Cont r ols sect ion of t he Ribbon, click Tit le and click t he for m

4. As t he label is st ill blinking, t ype Re d Oa k H igh School - St u de nt s and press Ent er 5. While t he t it le is st ill select ed, in t he Font sect ion of t he Ribbon, change t he follow ing charact er ist ics: Font : Ge or gia Font Size : 2 4 For e Color : Blu e St yle: Bold 6. Save t he form

A H yper link

I ntr oduction
A hyperlink is a label t hat can be clicked t o open an obj ect of t he dat a, an applicat ion on com put er, a file fr om t he net work, or a web sit e ( or web page) . Befor e using it , t he user can posit ion t he m ouse on t he label, which would change t he cur sor t o a point ing finger . The user can click. As st at ed alr eady, a hyper link can be m ade t o open alm ost any t ype of file or docum ent . When cr eat ing it , you will decide what obj ect or file would be opened or accessed.

Cr eating a H yper link


To cr eat e a hyper link, display a for m or a repor t in Design View:

Press Ct r l + K I n t he Cont r ols sect ion of t he Ribbon, click t he I nser t Hyper link cont r ol

A dialog box m ade of various sect ions w ould com e up. I n t he left sect ion, you can click Exist ing File or Web Page:

I n t his case, if you want t o open a file, click Cur r ent Folder and use t he Look I n com bo box t o specify t he folder wher e t he file is locat ed. Once you have specified t he folder , in t he lar ge list box in t he m iddle- cent er of t he dialog box, locat e t he file, click it and click OK. I f you want t o open a web page, you can choose one of t he pages you had previously visit ed. To do t his, in t he second colum n from left , click t he Br owsed Pages but t on. All t he files t hat t he dialog box can " rem em ber " would display in t he list in t he m iddle- cent er. You can t hen select t he file. You can also click t he ar row of t he Addr ess com bo box t o find out if t he web sit e or w eb page you w ant is in t he list . I f you know t he web sit e or t he w eb page you want t he link t o event ually open, t ype it in t he Address com bo box. Once you have specified t he file, click OK. This descr ipt ion also applies if you click t he Recent Files but t on. I f you want t he link t o open an obj ect of t he sam e dat abase, such as a form or a repor t , in t he left colum n, click Obj ect in This Dat abase. The m iddle- cent er of t he dialog box would display a t ree view :

Befor e select ing an obj ect , expand it s node, t hen select t he obj ect , and click OK. A hyper link is pr im ar ily a label. As such, t her e ar e som e char act er ist ics you can change for it but you should m ake sur e it would always be obvious t o t he user t hat it r epresent s a hyper link.

To change t he capt ion of t he hyperlink, you can click it once and click it again t o put it int o edit m ode, and edit it s capt ion. You can also use t he Pr opert ies window of t he hyperlink t o m anage t he label.

Pr actical Lear ning: Adding a H yper link


1. The St udent s for m of t he Red Oak High School dat abase should st ill be opened in Design View . I n t he Cont r ols sect ion of t he Ribbon, click Hyper link 2. I n t he I nsert Hyper link dialog box, click t he Addr ess t ext box and t ype h t t p:/ / w w w .fu nct ionx .com / r osh 3. I n t he Text t o display t ext box, r eplace t he t ext wit h School I nf or m a t ion

4. Click OK 5. Move t he hyperlink t o t he for m foot er sect ion 6. Save t he form and close it

Other Labels
The Page N um ber
I n a r epor t m eant t o display various r ecords on it s m any pages, you m ay want t o display t he page num ber . To assist you w it h t his, Micr osoft Access pr ovides a special label. To get it , display t he repor t in Design View. I n t he Cont r ol sect ion of t he Ribbon, click Page Num ber s and click t he repor t . The Page Num ber s dialog box would com e up:

Use t he Page Num bers dialog box t o specify what sent ence would be used, and w her e, t o display t he page num ber . Once you ar e r eady, click OK. The new label would be added t o t he Page Foot er sect ion of t he r epor t .

The D ate and Tim e


When displaying a for m , if you want t o show t he cur rent and/ or t im e, Micr osoft Access can assist you wit h a label. Before cr eat ing t he label, display t he for m or r epor t in Design View. To add t he label, in t he Cont rols sect ion of t he Ribbon, click Dat e and Tim e and click t he for m . The Dat e and Tim e dialog box w ould com e up:

Use t he dialog box t o specify what of t he dat e or t he t im e, including t he for m at s, would display. Once you ar e r eady, click OK. I f t he for m or r eport did not have t he appr opriat e header and foot er sect ion ( t he Form Header sect ion for t he form and t he Repor t Header sect ion for t he r eport ) , t he sect ion would be creat ed. I f t he sect ion exist ed alr eady, it would be used t o host t he label. When t he label is cr eat ed, by default , it is added t o t he header sect ion ( t he For m Header sect ion for t he for m and t he Repor t Header sect ion for t he r epor t ) . I f you do not like t hose posit ions, you can m ove t he label( s) . To do t his, sim ply click and dr ag it ( t hem ) t o t he desir ed sect ion.

The Text Box


I ntr oduction
A t ext box is a Window s cont r ol used t o get or display t ext for t he user s int eract ion. At it s m ost r egular use, a t ext box serves as a place t o fill out and pr ovide infor m at ion. You can also use it only t o display t ext wit hout allowing t he user t o change it s cont ent . Like m ost ot her cont rols, t he role of a t ext box is not obvious at first glance; t hat is w hy it should be accom panied by a label t hat defines it s purpose. Fr om t he user s st andpoint , a t ext box is nam ed aft er t he label closer t o it . Such a label is usually on t he left or t he t op side of t he cor r esponding t ext box. Ther e are t wo m ain ways you can add a t ext box t o a for m or r epor t :

Fr om t he Ribbon, you can click t he Text Box cont rol and click a sect ion of t he form or repor t . Unless you have a good alt er nat e r eason, m ost of your t ext boxes will be placed in t he Det ail sect ion. Som e t ext boxes used in expressions can be placed in anot her sect ion. By default , placing a t ext box on t he form or repor t also adds a corr esponding label t o it s left . I f you drag a t ext - based field fr om t he Field List and dr op it on t he for m or r epor t , t he field would place a t ext box and it s cor r esponding label.

Pr oper ties of a Text Box


Like ever y cont r ol on a form or r epor t , t he size of a t ext box is cont r olled by it s W idt h and H e ight propert ies. The posit ion of a t ext box is cont r olled by it s Top and Le ft proper t ies. To m ake a t ext box read- only, t hat is, if you do not want t he user t o ent er t ext in a t ext box, t her e are various alt ernat ives. I f you change t he En a ble d proper t y fr om Ye s t o N o , t he t ext box w ould have a gr ay background and cannot receive focus. I f you set t he Lock e d proper t y fr om N o t o Ye s , t he cont r ol would appear w it h a norm al ( whit e) backgr ound. The Spe cia l Eff e ct s proper t ies of t he t ext box ar e expanded as com pared t o t hose available on a label. Besides t he abilit y t o r aise or sink a t ext box, you can give it a t hick, et ched, or shadow bor der. Aft er adding a t ext box t o a for m or repor t , you can configur e it t o r eceive it s dat a fr om an exist ing t able. This can be done aft er t he Recor d Source of a for m or r epor t has been defined. To link a t ext box t o t he obj ect t hat is t he Recor d Sour ce of a for m or r eport , click t he ar r ow of it s Recor d Sour ce com bo box and select t he desir ed field.

Pr actical Lear ning: Adding Text Boxes


1. Re- open t he Bet hesda Car Rent al1 dat abase 2. I n t he Navigat ion Pane, r ight - click t he Asset s for m and click Design View

3. Double- click t he but t on at t he int er act ion of t he r uler s. I n t he Proper t ies window , click Recor d Sour ce and select Asset s 4. I n t he Tools sect ion of t he Ribbon, click Add Exist ing Fields 5. Fr om t he Field List , add each field and design t he form as you see fit :

6. Select each t ext box and, in t he Cont r ols sect ion of t he Ribbon, click t he ar row of t he Special Effect s but t on - > Shadowed 7. Save t he form and swit ch it t o Form View

8. Swit ch t he for m back t o Design View

Pictur es
I ntr oduction
A pict ure is a gr aphical obj ect t hat can be used eit her as t he backgr ound of a form or r eport or can be posit ioned on t op of a dat abase obj ect . Befor e using such a pict ur e, you should pr epare it or at least have it handy. I n Lesson 8, we saw t hat , t o use a pict ur e as t he backgr ound of a for m or repor t , in Design View, you could open t he Pr oper t ies w indow of t he for m or r eport . Then, in t he For m at t ab, you could click t he Pict ur e field t o r eveal it s ellipsis but t on, use t hat but t on t o locat e and r et r ieve t he pict ur e. Once added t o t he for m or repor t , you could use som e ot her pr oper t ies t o specify how t he pict ure w ould be displayed.

Pr actical Lear ning: I ntr oducing Pictur es


1. Fr om t he resources t hat accom pany t hese lessons, open t he Alt air Realt or s1 dat abase 2. On t he Ribbon, click Creat e and, in t he Form s sect ion, click For m Design

3. Double- click t he but t on at t he int er sect ion of t he ruler s t o access t he Pr opert ies w indow 4. Set t he Recor d Source t o Pr oper t ies 5. Save t he form as Propert ies 6. Right - click t he form and click For m Header/ Foot er 7. I n t he Cont r ols sect ion of t he Ribbon, click Label and click under t he For m Header bar 8. Type Pr ope r t ie s List in g and press Ent er 9. I n t he Tools sect ion of t he Ribbon, click Add Exist ing Fields and design t he for m as follows ( do not t r y t o m at ch t he font s; inst ead, select t he closest font s you have on your com put er )

10. Save t he form

U nbound Objects
I nst ead of an obj ect whose dat a is linked t o a field of t he dat abase, you can have an obj ect on your for m or repor t t o sim ply com plet e t he design of t he parent obj ect . That is t he case for logos or fine print s on form s and r epor t s. On a form or repor t , an obj ect whose dat a is not linked t o a specific r ecor d is referr ed t o as unbound. To add an unbound obj ect , display t he for m or r eport in Design View. I n t he Cont r ols sect ion of t he Ribbon, click t he Unbound Obj ect Fram e but t on and click on t he for m or repor t . I f t he Cont rol Wizar d but t on is clicked on t he Ribbon, a wizard w ill help you select t he obj ect you w ant t o add t o your for m or r epor t .

Pr actical Lear ning: Binding an Object


1. On t he Ribbon, m ake sur e t hat t he Use Cont r ol Wizar ds but t on is highlight ed . I n t he Cont r ols sect ion of t he Ribbon, click t he Unbound Obj ect Fr am e t he For m Foot er bar on t he right side and click under

2. On t he Micr osoft Office Access dialog box, click t he Creat e From File radio but t on and click Br ow se... 3. Fr om t he resources t hat accom pany t hese lessons, select t he Alt air .bm p file and click OK 4. On t he Micr osoft Office Access dialog box, click OK 5. Adj ust t he pict ur e and save t he for m before previewing it

6. Close t he form

Bound Objects
When r eviewing dat a t ypes, w e saw t hat a bound obj ect is one t hat is t ied t o an exist ing field on a t able. To add such a bound obj ect t o a for m or r eport , in t he Cont r ols sect ion of t he Ribbon, you can click Bou nd Obj e ct Fr a m e r eport : and click t he desired ar ea of t he for m or

You can t hen design t he size and posit ion of t he fram e as you see fit :

Since t he obj ect is ( supposed t o be) bound t o a field on t he source t able ( or t he sour ce r epor t ) , t he m ost im port ant piece of inform at ion you should pr ovide is t he t able's field t hat holds t he bound dat a. This is specified in t he Re cor d Sou r ce pr oper t y. Aft er doing t his, t he r ecor ds w ould show t he value of t he bound obj ect ( you should have associat ed t he obj ect s t o each r ecor d, using t he I nser t Obj ect dialog box) :

A Logo
A logo is a pict ur e t hat r epresent s or sym bolizes a com pany. You can use such a pict ur e on a for m or r epor t t o m ake it cut e. I n our discussion of unbound pict ur es, w e lear ned t hat we could add a pict ure independent of any r ecor d. We also had t o decide where t o posit ion t he pict ur e. I f w e w ant ed it t o act a as a logo, we had t o put it in t he for m header sect ion. To for m ally add a logo t o a for m a repor t , Micr osoft Access can assist you. Befor e using a logo in your dat abase, you m ust cr eat e it , design it , and save it as a pict ur e file. To add t he logo, display t he for m or r epor t in Design View. I n t he Cont r ols sect ion of t he

Ribbon, click Logo pict ure.

L o g o

. This would open t he I nser t Logo dialog box wher e you can select a

Pr actical Lear ning: Adding a Logo


1. Re- open t he Red Oak High School dat abase 2. I n t he Navigat ion Pane, under St udent s: Table, r ight - click t he St udent s form and click Design View
L o g o

3. I n t he Cont r ols sect ion of t he Ribbon, click Logo

4. Fr om t he I nser t Pict ur e dialog box, locat e t he r esour ces t hat accom pany t hese lessons and select t he rosh.png pict ur e 5. Click OK 6. Move t he logo t o t he left and t he t it le t o t he cent er of t he form foot er sect ion of t he for m :

7. Save t he form

The Line and the Rectangle


The Line
To enhance t he appear ance of sect ions or cont r ols on for m s and repor t s, Microsoft Access pr ovides a line obj ect . You can use it t o t race horizont al, vert ical, or diagonal lines of various pr eset widt hs. The use, posit ion, and orient at ion of a line only depend on your goal. To add a line, display t he for m or r epor t in Design View . I n t he Cont r ols sect ion of t he Ribbon, click t he Line obj ect and click t he form or report .

Pr actical Lear ning: Adding Lines


1. The St udent s for m of t he Red Oak High School dat abase should st ill be opened in Design View . I n t he Cont r ols sect ion of t he Ribbon, click Line t it le in t he form header sect ion and drag a horizont al line below t he and dr ag a hor izont al line below

2. Again, in t he Cont r ols sect ion of t he Ribbon, click Line t he first line

3. While t he new line is st ill select ed, in t he Cont r ols sect ion of t he Ribbon, click t he ar r ow of

t he lick t he Line Thickness but t on 4. Move bot h line t o t he left t o t ouch t he left bor der

and select 2 pt

5. Save t he form

The Rectangle
To enhance t he appear ance of sect ions or cont r ols on for m s and repor t s, Microsoft Access pr ovides a r ect angle obj ect . I t is not a cont r ol ( for exam ple, it does not " own" of fir e event s; in ot her wor ds, it does not progr am m at ically com m unicat e wit h t he oper at ing syst em , it does not st or e or receive dat a nor does it pr ovide dat a) . I t is a gr aphical obj ect prim arily int ended for aest het ic pur poses. Ther e is no for m al dir ect ive on how t o use t he r ect angle. Ther e ar e var ious r easons you would use a r ect angle on a for m or a r eport . You can use it t o " hold" ot her cont rols. For exam ple, if you want t o isolat e a gr oup of cont r ols, you can include t hem inside of a rect angle. To add a r ect angle, display t he for m or r epor t in Design View. I n t he Cont rols sect ion of t he Ribbon, click t he Rect angle obj ect and click t he form or r epor t . To exploit t he aest het ic r ole of a rect angle, you can change such as aspect s as t he back color , t he bor ders, or t he special effect s, et c.

Pr actical Lear ning: Adding a Rectangle


1. The St udent s for m of t he Red Oak High School dat abase should st ill be opened in Design View . I n t he Cont r ols sect ion of t he Ribbon, click Rect angle for m and click t he Det ail sect ion of t he

2. While t he r ect angle is st ill select ed, in t he Font sect ion of t he Ribbon, click t he arr ow of t he Fill/ Back Color but t on and select Backgr ound ( Access Them e Color s: 5t h colum n - 1st r ow) 3. I n t he Cont r ols sect ion of t he Ribbon, click t he ar row of t he Special Effect s but t on and select Special Effect s: Shadowed 4. Access t he Pr oper t ies window of t he for m and set it s Recor d Select or s pr oper t y t o No

5. Save t he form

Lessons Sum m ar y
M CAS: U sing M icr osoft Office Access 20 0 7 Topics
C7 Modify t he design of repor t s and for m s

Você também pode gostar