access lab 2zbzhdhdhdf

Upload: calvin-romario

Post on 04-Jun-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    1/12

    IS 4420 - Access Lab 2

    Objectives:

    A. Create data entry forms including forms on single table and main/sub forms

    B. Generate reports

    C. Use form to create user interface.D. Design more advanced forms

    E. In class exercise

    A. Create Data Entry Forms

    1. Create a orm or !e"artment tab#e.

    Clic on Formsbutton in t!e database "indo"# and t!en clic on $e%toolbar button. In t!e drop$

    do"n box labeled %C!oose t!e table or &uery "!ere t!e ob'ect(s data comes from)# select

    !e"artmenttable from t!e list. *o as ACCE++ !elp us build a form using !e"artmenttable#

    please select Form &i'ar! in t!e list and t!en clic onO(.

    +pecify t!e particular fields you "ant to include in t!e form. Assuming you "ant allt!e fields from!e"artmenttable# clic on t!e button "it! t%o ri)*t-"ointin) arro%s. *!en# please clic on $e+tbutton to continue.

    ,

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    2/12

    C!oose a specific type of form layout for Co#,mnar and t!en clic on $e+tbutton to continue.

    C!oose a particular style for t!e form and t!en clic on $e+tbutton.

    -ame t!e form e.g.# De"artment and clic on Finis*button. At t!is point# a form e.g.# named

    !e"artment !as been created.

    2. Create a orm main an! s,b-orm to !is"#ay an! s,""ort ,"!atin) inormation abo,t

    em"#oyee an! t*eir !e"en!ents.

    *o create em"#oyee main orm# please repeat t!e steps in ,. Clic on Formsbutton in t!e database"indo" and t!en clic on $e%button on t!e toolbar. In t!e drop$do"n box labeled %C!oose t!e

    table or &uery "!ere t!e ob'ect(s data comes from)# select em"#oyeetable from t!e list. *o asACCE++ !elp us building a form using em"#oyeetable# please select Form &i'ar! in t!e list and

    t!en clic on O(.

    Clic on t!e button "it! t%o ri)*t-"ointin) arro%*ea!s to select allt!e columns in t!e em"#oyee

    table into t!e form. *!en# clic on $e+tbutton to continue.

    C!oose a particular layout type for Co#,mnarand t!en clic on $e+tbutton to select form style.

    -ame t!e form e.g.# Em"#oyee and t!en clic on Finis*button. At t!is point# a ne" form e.g.#

    Em"#oyee !as been created.

    After creatingEm"#oyee

    form# clic onDesi)n

    button in t!e database toolbar and select t!eform

    designmode.

    0

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    3/12

    /a+imi'e t!e form design "indo" and move t!e cursor to ,""erborder of t!eorm ooter and

    !ra) it !o%n. By doing so# you can !ave more display space to include a dependent subform in t!eform e.g.# Em"#oyee.

    Clic on s,bormbuttonin t!e floating toolbox panel and your cursor "ill loo lie . If you

    cannot see t!e toolbox# go to ie% menu and select oo#bo+ button and t!en oo#bo+ panel

    s!ould s!o" up. -ext# go to t!e gray area and drag a rectan),#ar to create a subform in

    Em"#oyee main form. A s,borm %i'ar!"ill t!en pop up automatically.

    1

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    4/12

    In s,borm %i'ar! !ia#o) bo+# select 3se e+istin) tab#es an! ,eries5and clic on $e+t

    button.

    Assuming "e "ant to include all t!e columns in !e"en!ent table in em"#oyee main form# "e

    c!oose !e"en!enttable from t!e drop$do"n menu and clic on t!e button "it! t%o ri)*t-

    "ointin) arro%*ea!sto includeallcolumns. *!en# clic on $e+tbutton to continue.

    -ext# select Deine my o%n5 to define t!e specific fields in t!e main form to b lined to t!esubform. 2e "ill t!en use SS$in em"#oyee main form to lin "it! ESS$in !e"en!entsubform.

    Clic on $e+tbutton and t!en name t!e subform e.g.# De"en!entS,borm. Upon clic on

    Finis*button# you !ave created a form t!at displays t!e data of eac! employee# toget!er "it! !is

    or !er dependents.

    6. Create a orm t*at can !is"#ay inormation o a !e"artment an! its #ocations.

    Clic on Formsbutton in t!e database "indo" and t!en clic on $e%button in t!e toolbar. In t!e

    drop$do"n box labeled %C!oose t!e table or &uery "!ere t!e ob'ect(s data comes from)# select

    !e"artmenttable from t!e list. *o as ACCE++ !elp us building a form using !e"artmenttable#select Form &i'ar! in t!e list and t!en clic on O(.

    Clic on t!e button "it! t%o ri)*t-"ointin) arro%*ea!s to include in t!e form allt!e columns in!e"artmenttable and t!en clic on $e+tbutton to continue.

    +elect a particular layout type for Co#,mnarand t!e clic on $e+tbutton to define form style.

    -ame t!e form e.g.# De"artmentLocation/ainForm and t!en clic on Finis*button to create a

    main form.

    After creating De"artmentLocation/ainForm# clic on Desi)nbutton in t!e database toolbar to

    activate t!e form design mode.

    3

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    5/12

    /a+imi'e t!e form design "indo" and move your cursor tot!e,""erborder of t!eorm ooter

    and!ra) it !o%n. By doing so# you can !ave more display space to include a department location

    subform in t!e form e.g.# De"artmentLocationS,bForm.

    Clic on s,bormbuttonin t!e floating toolbox panel and your cursor "ill loo lie . If you

    cannot see t!e toolbox# go to ie% menu and select oo#bo+ button and t!en oo#bo+ panel

    s!ould s!o" up. -ext# go to t!e gray area and drag a rectan),#ar to create a subform inDe"artmentLocation/ainForm. A s,borm %i'ar!"ill t!en pop up automatically.

    Assuming t!at "e "ant to include all t!e columns in De"t7Locationstable in t!is subform# select

    !e"t7#ocationstable from t!e drop$do"n menu and clic on t!e button "it! t%o ri)*t-"ointin)

    arro%*ea!sto include all t!e columns in dept4locations table. *!en# clic on $e+tbutton to

    continue.

    -ext# select Deine my o%n5 option to define t!e particular fields of t!e subform to be lined to

    t!e main form. 5lease use De"$o in De"artmentLocation/ainForm to lin to De"$o in

    De"t7#ocationsS,borm.

    Clic on $e+tbutton and t!en name t!e subform e.g.# De"tLocationsS,borm. Upon clicing

    on Finis*button# you !ave created a form t!at displays data on departments and t!eir locations.

    8. 9enerate a e"ort

    ,. Design a report t!at lists all employee information# grouped by department number.

    Clic on t!e %e"ort) ob'ect button in t!e database "indo"# and t!en clic on t!e %$e%) button

    on t!e toolbar. In t!e drop$do"n box labeled %C!oose t!e table or &uery "!ere t!e ob'ect(s data

    comes from)# select em"#oyeetable from t!e list. *o as Access !elp us building a form using t!e

    %department) table# please select t!e %e"ort &i'ar!) on t!e list and t!en clicon%O().

    Assuming t!at "e "ant to include in t!e report all t!e columns except addressin t!e %employee)table# please clic on t!e b,tton %it* t%o ri)*t-"ointin) arro%sto select all t!e columns and

    t!en use t!e b,tton %it* one #et-"ointin) arro% to ,nse#ect t*e a!!ress co#,mn . *!en# clic on

    t!e %$e+t)button to continue.

    +elect t!e %De"$o) on t!e left$!and side menu and t!en clic t!e rig!t$arro" to include it in t!e

    group$level of t!e report. By doing so# you can generate a report t!at groups all employee

    information using department number. *!en# clic on %$e+t) button to continue.

    6

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    6/12

    In t!e next dialog box# clic on t!e%S,mmary O"tion) button# c!ec on t!e %av)) option and

    clic on %O().

    +elect %A#i)n #et 1) be t!e report layout and %Lan!sca"e) be t!e orientation. *!en# clic t!e

    %$e+t)button to continue.

    After selecting a particular style you lie for t!e report and naming t!e report e.g.# EmployeeInfo#

    clic on t!e %Finis*) button and Access "ill t!en automatically generate a report t!at groups all

    employee information by %Dep-o) and s!o"s eac! department(s average salary.

    7ou can al"ays clic on t!e %Desi)n) button on t!e database toolbar to reformat a report. Afteryou complete redesigning t!e report# you can go to t!e %ie%) menu and c!oose %#ayo,t "revie%)

    to see t!e outcomes. .

    0. Design a report t!at lists all department information.

    Clic on t!e %e"ort)ob'ect button in t!e database "indo"# and t!en clic on t!e %$e%) button

    on t!e toolbar. In t!e drop$do"n box labeled %C*oose t*e tab#e or ,ery %*ere t*e object;s !ata

    comes rom)# select %!e"artment) table from t!e list. *o as Access to !elp us building a form

    using t!e department table# please select t!e %e"ort &i'ar!)in t!e list and t!en clic on %O().

    Assuming "e "ant to include in t!e report all t!e columns in t!e %!e"artment) table# please clic

    on t!e b,tton %it* t%o ri)*t-"ointin) arro%sto select all t!e columns. *!en# clic on t!e %$e+t)

    button to continue.

    Assuming you don(t "ant to include grouping in t!e report# please simply clic on t!e %$e+t)

    button to continue.

    In t!e next dialog box# please select t!e %De"$o) column from t!e drop$do"n menu and t!en clic

    on t!e %Ascen!in)) button on t!e rig!t to sort %De"$o) by descending order. Clic %$e+t).

    8

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    7/12

    +elect %ab,#ar) be t!e report layout and %

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    8/12

    3. +elect %e"ort O"erations) select %;orm . ;ollo" similar process to create t!ree more buttons called %Department =eport)# %Department

    ;orm)# and %Employee ;orm)# clic t!e %+ave) button and save t!e form as %?ain)# and you "ill seet!e "indo" as t!e follo"ing9

    >

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    9/12

    @. Go to t!e Form ie%# and you can clic t!e buttons to open t!e reports and forms you "ant.

    D. Create more a!vance! orms

    In t!is section "e are going to create a more advanced form t!at includes , more complex toolbar

    ob'ects suc! as combo box# list box# etc. and 0 command button "it! BA code. *!is form is forentering ne" dependent information.

    ,. Clic on t!e %Form) ob'ect button in t!e database "indo"

    0. Double clic %Create orm in Desi)n vie%)

    1. +ave t!is form as orm$e%De"en!ent

    3. *!ere are five fields in t!e Dependent table# t!erefore "e s!ould !ave five corresponding toolbar

    ob'ects. But since "e no" t!e sex of t!e dependent given t!e relations!ip bet"een t!e employee andt!e dependent# "e only need four toolbar ob'ects instead

    6. Create a combo box for E++-

    a. clic Combo 8o+on t!e *oolbarb. clic $e+tc. select 3SE==7E/EE tab#e# and clic $e+t

    @

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    10/12

    d. add SS$? F$A/E? /I$I? an! L$A/Efrom t!e available fields to t!e selected fields# and

    clic $e+t

    e. Unc!ec @i!e ey co#,mn# and clic $e+tf. ?ae sure SS$is selected# and clic $e+tg. Enter Em"#oyee SS$under 2!at label "ould you lie for your combo box# and clic Finis*

    !. Double clic t!e combo box# c!ange t!e -ame to cboESS$i. +"itc! from Design ie" to Form ie%# you "ill see !o" t!e combo box "ors

    '. +"itc! bac to Desi)n ie%

    8. Create a text box for Dependent4-ame

    a. clic e+t 8o+on t!e *oolbar# and create a text box on t!e form

    b. c!ange t!e Caption of t!e label to De"en!ent $ame

    c. c!ange t!e -ame of t!e text box to t+tD$ame

    :. Create a text box for +ex

    a. clic e+t 8o+on t!e *oolbar# and create a text box on t!e form

    b. c!ange t!e Caption of t!e label to De"en!ent 8irt* Datec. c!ange t!e -ame of t!e text box to t+t8Date

    >. Create a list box for =elations!ip

    a. clic List 8o+on t!e *oolbar# and create a list box on t!e form

    b. select I %i## ty"e in t*e va#,es t*at I %ant# and clic $e+tc. under Col,# enter four ro"s of data9 @,sban!? &ie? Son? an! Da,)*ter# and clic $e+td. enter e#ations*i"under 2!at label "ould you lie for your list box

    e. c!ange t!e -ame of t!e list box to #ste#ations*i"t!e first lettler is a lo"er case

    @. Add a command button to save t!e entered data

    a. clic Comman! 8,ttonon t!e *oolbar# create a command button# and clic Cance#

    b. c!ange t!e Caption of t!e command button to Savec. c!ange t!e -ame of t!e command button to cm!Saved. in t!e property "indo" for cmd+ave as s!o"n belo"# select Event

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    11/12

    e. type in t!e BA code belo" bet"een t!e t"o solid double lines.

    5rivate +ub cmd+ave4Clic

    Dim strE++- As +tring

    Dim strD-ame As +tring

    Dim str+ex As +tring Dim str=elations!ip As +tring

    Dim strBDate As +tring

    Dim str+ As +tring

    strE++- cboEmployee.alue

    strD-ame txtD-ame.alue

    str=elations!ip lst=elations!ip.alue

    strBDate txtBDate.alue

    If str=elations!ip F2ifeF

    Double &uote# single &uote# comma# single &uote# double &uote

  • 8/13/2019 Access Lab 2zbzhdhdhdf

    12/12

    ,0. Clic >es

    ,1.