BCS - Access Exercise

download BCS - Access Exercise

of 49

Transcript of BCS - Access Exercise

  • 8/6/2019 BCS - Access Exercise

    1/49

    Database Exercise 1Database tables

    Learning Outcomes

    You will understand that all data is stored in database in tables and that eachdifferent set of data subjects will have its own table.

    Data is stored in records with fields each holding a category of data.

    Data should be atomised in the table (broken down into its smallest parts - Mr JohnSmith should exist in 3 fields). You will create a new data storage table and will add use various validation

    techniques for each field including:o setting data typeo setting field lengtho creating drop down listso setting default valueso establishing input maskso setting validation rules and feedback messages

    You will test the database validation at each step of the implementation processand keep records of the testing completed.

  • 8/6/2019 BCS - Access Exercise

    2/49

    Database Exercise 1 Database tables

    Page 1 of 12

    Data is always stored in tables in an Access database. The most important thing toremember when you set up a database is that the way that you set up the fields willaffect what you can do with your database later on . The more thoughtfully you

    arrange your database from the outset the easier it will be to get the information youwant on later.

    Learning Objectives: To create a table in MS Access to store details of customers To understand and define field properties To set data validation in order to reduce the likelihood of error To test the table

    Open your database file called video1Click on Tables in the object bar .Click New then Design View

    Click OKThis will open a new table in design view

    Establishing field names

  • 8/6/2019 BCS - Access Exercise

    3/49

    Database Exercise 1 Database tables

    Page 2 of 12

    When you set up a table then you must also choose the type of data that can be entered. Intable design view there are three columns, Field Name , Data Type and Description . Thedefault data type for fields in text. A field name can be up to 64 characters long but itcannot contain full stops, exclamation marks or brackets. It is better to use shortenednames and if necessary use the description section to explain the purpose of the field. Try

    to avoid using spaces and use CamelCaps or under_scores to show the beginnings of newwords in the file name if desired.

    Enter new fields, data types and descriptions as shown below:

    Setting the Primary KeyThe field in the table which uniquely identifies each record is known as a primary key .You can get Access to set primary keys automatically.The primary key field in this database is MemID .Highlight the MemID field then click on the Primary Key button on the toolbar.Save the table as tblMembers

  • 8/6/2019 BCS - Access Exercise

    4/49

    Database Exercise 1 Database tables

    Page 3 of 12

    Setting field properties and validationFor each field we can set some degree of validation. Property settings are importantbecause it allows the user to create rules that control what is typed into each field. Thiswill compel users to enter data that is more likely to be correct or at least in the correctformat.

    When you are setting the validation for each field then click next to the field name. Ablack triangle marks the active field. When you are on a particular field the propertiesbox will show property settings for this field. What rules you enter depend on what makessense for each field

    MemID fieldNote that, now that you have set the property of this field to be a primary key, theproperties of the field have changed so that duplicates are no longer allowed. No othervalidation is needed as Access will automatically enter data into this field.

  • 8/6/2019 BCS - Access Exercise

    5/49

    Database Exercise 1 Database tables

    Page 4 of 12

    MemCode field data only accepted within a certain range called a range check

    The MemCode field must be a whole number between 10000 and 99999. We can set rulethis in the properties of that field

    Set Field Size to long integer (only whole numbers will be accepted)Set Validation Rule to Between 10000 And 99999 (this means that only accept numberswithin the stated range will be accepted)Set Validation Text to Value must be between 10000 and 99999 (this is meant to be ahelpful message that will tell someone what range of data is accepted)Set Required to Yes (this means that the field cannot be left blank)Set Indexed to Yes (no duplicates) (this means that no duplicate entries will be allowed every membership code will be unique)

  • 8/6/2019 BCS - Access Exercise

    6/49

    Database Exercise 1 Database tables

    Page 5 of 12

    Testing the MemCode field validationWhen testing validation in a field, you should consider what type of data will be allowedor not. Usually you will identify normal data (between 10000 and 99999 in this case),extreme data (below 10000 or above 99999), invalid data (data of the wrong data typesuch as text) and erroneous data (such as a number within range but not a whole number.

    Switch to datasheet view and enter the following data:76985 (normal), 192089 (extreme), ten thousand (invalid), 76985.5 (erroneous)

    If you enter the wrong data you will receive a number of different error messages:

    If you enter data outside of the permitted range you get this message.This was the message that you set in the validation text

    If you enter data that is of the wrong data type then you will get this message:

    You have also set a presence check so that the field cannot be left blank

  • 8/6/2019 BCS - Access Exercise

    7/49

    Database Exercise 1 Database tables

    Page 6 of 12

    MemTitle field Creating lookup lists

    For the field Title you will create lookups which will allow the user to choose betweenMr, Mrs, Miss or MsClick in the Data Type column and select the Lookup Wizard .

    In the first step of the Lookup Wizard, select I will type in the values that I want .

    Click Next

  • 8/6/2019 BCS - Access Exercise

    8/49

    Database Exercise 1 Database tables

    Page 7 of 12

    Enter the values as shown in the diagram

    Click next

    Keep the field name

    Click Finish

    You can switch to datasheet view using the first button on the toolbar and check thatthe drop down list works before moving on to the next page. Working in design view on the MemTitle field, change the value in the length field to 256. You should get an

  • 8/6/2019 BCS - Access Exercise

    9/49

    Database Exercise 1 Database tables

    Page 8 of 12

    error message, because the word byte in the field size row does not allow you to entervalues greater than 255. This is a type of data validation limiting what can be entered intothe field. Set the field size to 4

    Click the Lookup tab set the Limit To List property to Yes

    This means that only Mr, Mrs, Miss or Ms will be accepted

  • 8/6/2019 BCS - Access Exercise

    10/49

    Database Exercise 1 Database tables

    Page 9 of 12

    MemFName field using input masksIn the MemFName field we want to ensure that the format of the name is correct with acapital first letter and all letters afterwards (names do not usually have numbers in them.This is achieved using an input mask. A > forces capitalization, a L symbol means that atleast one letter must be present (OK for initials then), the < symbol means that all the

    remaining letters will be lower case. The question marks are the symbol in an input mask for optional letters (numbers are not allowed)

    Set the input mask to >L

  • 8/6/2019 BCS - Access Exercise

    11/49

    Database Exercise 1 Database tables

    Page 10 of 12

    MemAdd2 fieldSet the field length to 25

    MemAdd3 field lookup list

    Set the field length to 25Using the same technique as for the MemTitle field create a lookup list for five of thenearest towns.

    MemPostCode field setting a required property known as a presence checkSetting validation for post codes can be tricky because they are not all the same lengthand not always in a consistent format.Set field length to 8

    Set the input mask to >Laaaaaaa This will force all the letters to be capitalised, ensure

    that the first character is a letter and allow any mixture of numbers, letters or spaces afterthat up to eight characters in total

    In this case we are also going to make the MemPostCode field a required field. Click inthe box beside the word Required . Click on the arrow that appears and select Yes fromthe list. This means that users cannot enter a new member without entering their postcode

    MemPNumber field input maskPhone numbers do not have a numerical value and should always be set as text data type(otherwise the zero at the beginning of the number will not be displayed).All British phone numbers are 11 digits long (comprised of 5 digit area code and 6 digitnumber) set text length = 11

    Set the input mask to 99999999999. The character 9 in an input mask means that only anumber can be entered - this will require the user to enter only numbers and notaccidentally enter text

  • 8/6/2019 BCS - Access Exercise

    12/49

    Database Exercise 1 Database tables

    Page 11 of 12

    MemDoB field data only accepted within a range known as a range checkThe year entered should not be greater than the current year nor should it be a ridiculoustime in the pastSet the validation rule toL (enforcing capitalization, preventing entry of m or f)Set the Validation Rule to = M or F

    Set the Validation Text to Value must be M or F Set Required to Yes

    EnrolDate field default data

    We want this field to be automatically entered set default value to =now()

    You should test all of your fields with a range of data to ensure that the validationworks (tip some of the validation set in this exercise prevents perfectly valid datafrom being entered properly you mission is to find out which!)

  • 8/6/2019 BCS - Access Exercise

    13/49

    Database Exercise 1 Database tables

    Page 12 of 12

    Sample Members dataMemCode Title FName LName Add1 Add2 Add3 PostCode MemNum

    10001 Mr Chad Joggins 45 Cottage Hill Princethorpe Rugby CV238PX 019260987510002 Mr Brad Noggins The Inn Princethorpe Rugby CV239PX 01926678310003 Ms Jad Boggins 37Green Lane Long Lawford Rugby CV237TH 01788345610004 Mr Kad Stoggins 102 Red Street Binley Coventry CV46JM 024764326

    10005 Miss Taz Yoggins 99 Yellow Road Princethorpe Rugby CV232RC 019262346710006 Mr Rad Woggins Pink Pub Heathcote Leamington CV314SX 01926437510007 Mrs Nat Doggins Old Post Office Whitley Coventry CV32UP 02476879010008 Mr Cad Toggins The Old School Brownsover Rugby CV236GZ 017882345610009 Mr Ad Poggins 54 Blue Lane Coventry Coventry CV26YK 02476546710010 Mrs Caz Coggins White Cottage Easthorpe Rugby CV237PD 019265678

  • 8/6/2019 BCS - Access Exercise

    14/49

    Database Exercise 2 Database Queries

    Learning outcomes

    You will understand basic database vocabulary and that the function of a databaseis to store data and produce information.

    You will be familiar with opening an Access database and working in MS Access You will be able to create a simple query selecting specified records and fields and

    sorting data from existing data stored in a database. You will go on to create a range of more complex queries in order to find specific

    information from existing data stored in a database using a combination of search

    criteria including:o Find records that match one criterion AND anothero Find records that match one criterion OR anothero Find records that match one criterion but NOT anothero Find records that match BETWEEN one criterion and anothero Find records that match similar to, or LIKE, a particular criteriono Use parameter value queries to perform a "fuzzy" search.

    You will be able to create their own queries using a combination of various criteriaand appreciate that queries based on fields with different data types require criteriaformed with different syntax

  • 8/6/2019 BCS - Access Exercise

    15/49

    Database Exercise 2 Database Queries

    Page 1 of 12

    THE BASIC ELEMENTS OF A DATABASEA database is a tool for storing, organising and finding information and processingdata (raw facts and figures) into useful informationData stored in a database is divided into fields and records. A record is all the information about one person, product, company or event (these are

    known as data subjects in the database.)The information about each data subject is divided into categories common to eachrecord, for example, name, address, telephone number etc. These are known as fields.Each field has a field name and the information you enter into a field is known as a fieldentry .

    WORKING IN MICROSOFT ACCESSMicrosoft Access is different to other programs. To people who are used to working withMicrosoft Word or Excel, Access might come as something of a shock. Whereas there aresome aspects of this program that might seem familiar, others are completely different

    and this sometimes takes a little adjustment.The main differences between Access and other programs include: Setting the file name before entering data (this is a safety aspect to prevent data

    loss data is saved as you work) Data being saved as you work The ability to view data in many different ways, some of which are only intended

    for viewing on the screen not for printing.

    Access objects are divided intomain areas such as tables, queries

    or reports. Each of group of objectsis opened by clicking the correcttab on the main dialogue box.

    In this unit of work you will learnabout the following:Tables the main place where data isstored. Queries allow the user toselect chosen information from thetable or tables.

    Forms can be designed to alloweasier data entry.Reports allow for printing information based on tables or queries.

  • 8/6/2019 BCS - Access Exercise

    16/49

    Database Exercise 2 Database Queries

    Page 2 of 12

    Simple queriesThe main purpose of a database is to store data (raw facts and figures) and process thedata into meaningful information. In this exercise you will create a query in order to find specific information from existing data stored in a database.

    Locate the file called Video1.mdb Make a copy of this file in your own user area.Double click the file in order to open MS AccessNote that there is already a table of data stored in the database called tblVideos.

    Double click the object tblVideos and have a look at the data stored there

    Close the table (but not the whole database).

    Query 1 displaying certain from fields and sorting the dataClick on Queries tab

  • 8/6/2019 BCS - Access Exercise

    17/49

    Database Exercise 2 Database Queries

    Page 3 of 12

    Click Create query in Design view .

    Click on tblVideos in table list and then click on Add.

    Click Close on this dialogue box

  • 8/6/2019 BCS - Access Exercise

    18/49

    Database Exercise 2 Database Queries

    Page 4 of 12

    Drag the VideoID , title and certificate fields to the query grid.

    The query that you have created will only show data from the three fields that you haveselected. In order to view the data, click the view button (this is the first button from theleft of the toolbar). This will take you from design view to datasheet view

    Datasheet view

    Note that you have only shown the fields that you selected and not the all of the data inthe data set. (See how this view is different from the view of the whole table on page 1 of this leaflet)Switch back to design view of query by clicking on view button again.Click on the Save button and save the query with the name qryFilmList

    The list of films might be more useful if it were in alphabetical order.Working is design view, click the drop down list in the Sort cell in the Title column.

  • 8/6/2019 BCS - Access Exercise

    19/49

    Database Exercise 2 Database Queries

    Page 5 of 12

    Choose Ascending Switch back to Datasheet view.

    Note how the films are now listed alphabeticallySave the query

  • 8/6/2019 BCS - Access Exercise

    20/49

    Database Exercise 2 Database Queries

    Page 6 of 12

    Query 2 - Refining your search and only showing certain recordsIt is possible to refine the way Access processes the data still furtherWorking in design view type 15 in the criteria row in the certificate column

    Switch back to data sheet view

    Note how the data set now only displays films with a 15 certificate. Our query now showsonly fields that we specified and only records meeting specified criteria.Save the query

  • 8/6/2019 BCS - Access Exercise

    21/49

    Database Exercise 2 Database Queries

    Page 7 of 12

    Complex QueriesIn a previous exercise you made a query which found information according to onecriterion. A complex query is one where you use a combination of criteria. You can look for criteria in various combinations. For example Find records that match one criterion AND another

    Find records that match one criterion OR anotherFind records that match one criterion but NOT anotherFind records that match BETWEEN one criterion and anotherFind records that match similar to, or LIKE , a particular criterion

    In this exercise you will create some more queries but these will use a combination of criteria to produce more detailed information

    Return to the file that you have already created called Video1.mdb If its not already open, double click the file in order to open MS Access

    Query 3 using AND to find records which match two search criteriaYou will create a query to find films that are Musicals AND had an award Click on Queries tabClick Create query in Design view .Click on tblVideos in table list and then click on Add.Click CloseAdd the fields Title, Category, Year, Award and Rating fields to the query grid .In the criteria cell of the Award field, type TrueIn the criteria cell of the Category field type: MusicalFor AND queries place criteria in same row of the grid

    Switch to datasheet view to see the result of your query.How many records match these criteria?Save the query as qryMusicalAward.

  • 8/6/2019 BCS - Access Exercise

    22/49

    Database Exercise 2 Database Queries

    Page 8 of 12

    Query 4 using OR to find record which match one criteria OR another This query will use the OR operator to find either 15 Or 18 certificate films.Create a new query based on tblVideosAdd the fields Title, Category, Certificate and Rating to the query grid .In the criteria cell of Certificate field type: 15, i n the OR cell type 18

    Switch to datasheet view to see the result of your query.How many films match these criteria?Save the query as qry15or18.

    Query 5 using BETWEEN to find data that falls in a certain range This query will use AND to find films released between 1980 and 1989Create a new query based on tblVideosAdd the fields Title and Year.In the criteria cell of the Year field type Between 1980 And 1989Also click in the sort cell and sort Year into ascending order .

    Switch to datasheet view to see the result of your query.How many films were released during this decade?Save the query as qryEightiesFilms.

  • 8/6/2019 BCS - Access Exercise

    23/49

    Database Exercise 2 Database Queries

    Page 9 of 12

    Query 6 using LIKE to do a fuzzy search Sometimes we want to use a query to find a specific record in a field with otherinformation. The LIKE function allows us to find films featuring certain actors.Create a new query based on tblVideosAdd the fields Title, Category, Director, Rating and Cast to the query grid .

    In criteria cell of the Cast field type: like *Schwarz* (the * stands for anything eitherside of the word Schwarz this saves typing Schwarzenegger!)

    Switch to datasheet view to see the result of your query.Save query as qrySchwarzeneggerFilms

    Query 7 - using NOT to find something that doesnt match certain criteria Create a new query based on tblVideos Add the fields Title, Category

    In criteria cell of the Category field type Not Musical And Not Comedy

    Switch to datasheet view to see the result of your query.Save query as qryNotMusicalOrComedy

  • 8/6/2019 BCS - Access Exercise

    24/49

    Database Exercise 2 Database Queries

    Page 10 of 12

    Query 8 using parameter valuesRather than write a new query for every eventuality it is possible to create a query thatprompts the database user to type in a query criterion. This is known as using parameter values and is done using square brackets [ ] in the criteria cell.

    Create a new query based on tblVideosAdd the fields Title, Category, Director, Rating and Cast to the query grid .In the criteria cell in the Cast field type Like [Enter Name]

    Switch to datasheet view to see the result of your query.When prompted type *cruise* (remember to include the *s)

    Click OK

    Save the query as qryLike.

  • 8/6/2019 BCS - Access Exercise

    25/49

    Database Exercise 2 Database Queries

    Page 11 of 12

    Query 9 using greater that, less than or equalsWhen you want to search for values in numerical fields you have to use slightly differentsyntax (wording). For example in text fields the text search criterion is alwayssurrounded by speech marks (Access even puts them in automatically).In number fields you never use speech marks.

    Create a new query based on tblVideosAdd the fields Title, Category, and Length to the query grid .In the criteria cell in the Length field type 100 or =100Switch to datasheet view to see the result of your queries.

  • 8/6/2019 BCS - Access Exercise

    26/49

    Database Exercise 2 Database Queries

    Page 12 of 12

    Extension activities Additional queriesCreate complex queries to find the following information:

    1. Classification 15 films that are over 100 minutes in length2. SciFi films with a rating of 53. PG films with a rating of 4.4. Films that are either Musicals or Comedies.5. Films that have been directed by Gurinder Chandha or George Lucas6. Films featuring the following actors:

    a. Arnold Schwarzeneggerb. Tom Cruisec. Helen Hunt

    7. Comedies made:a. Before 1990b. Between 1990 and 2000

    c. After 20008. Science Fiction films made:a. Before 1990b. Between 1990 and 2000c. After 2000

    9. Films in the Star Wars series listed in the order they were released10. A list of films that are not specifically suitable for family viewing.

  • 8/6/2019 BCS - Access Exercise

    27/49

    Database Exercise 3

    Making Data Entry Forms

    Learning Outcomes

    You will consider that forms are a useful and convenient way of entering data into

    an underlying table.

    You will be able to identify the difference between columnar and tabular forms

    and know the advantages of entering data through a columnar form

    You will consider the layout of a data entry form in terms of how easy it is to use

    by another person.

    You will seek feedback from other users and amend their work accordingly

    Extension activity

    Introduce a picture field into the table (data type OLE object). Working in

    Design View, introduce this field into the Video form. Copy and paste

    appropriate pictures from the internet for each film

  • 8/6/2019 BCS - Access Exercise

    28/49

  • 8/6/2019 BCS - Access Exercise

    29/49

    Database Exercise 3 Making Data Entry Forms

    Page 2 of 14

    Select the table tblVideos from the drop down

    list

    Click the double arrow to select all of the

    fields

    Click Next Click Next

    Choose Columnar, Choose the standard colour scheme

  • 8/6/2019 BCS - Access Exercise

    30/49

    Database Exercise 3 Making Data Entry Forms

    Page 3 of 14

    Click Next Click Next

    Save the form as frmVideos The new data entry form

    Changing the appearance of the form

    In order to change the design of the form, you must be working in Design view .

    Click the View icon on the far left of the toolbar and switch to Design view .

  • 8/6/2019 BCS - Access Exercise

    31/49

    Database Exercise 3 Making Data Entry Forms

    Page 4 of 14

    Notice the floating toolbox that appears in Design view (you can turn it on and off using

    the button on the form design tool bar). Using the mouse increase width and depth of the

    form so that it fills in the whole page

    Click in the blank area to the bottom right of the Cast field.

    Keeping the mouse button pressed, drag upwards to the top left of the form so that you

    select all of the fields.

  • 8/6/2019 BCS - Access Exercise

    32/49

    Database Exercise 3 Making Data Entry Forms

    Page 5 of 14

    You should be able to click and move all of the fields together using the mouse.

    Add a label to your form

    Click the label button on the toolbox.

    Draw a label above the fields

    Type in a suitable label (such as Enter Details of Videos)

    Click way from the label then click on it again

    Change the size of the label so that it is bigger

    Add Colour to your Form

    Right Click on background of the form and select Fill/Back color

    Choose a suitable colour

  • 8/6/2019 BCS - Access Exercise

    33/49

    Database Exercise 3 Making Data Entry Forms

    Page 6 of 14

    Add a Picture to your Form

    Click the Image Tool in the Toolbox.

    Drag out an area for the picture ion your form.

    You will be prompted to browse for a picture

    Find the file DVD-icon.jpg and click OK.

    Resize the picture if necessary

    Save the form and switch to Form View to check the appearance of your form.

    Adding Navigation and Form Buttons

    Working in Design View, click the Command Button tool in the Toolbox.

    Drag out an area on the form

    Select Find Record from the Record Navigation section

  • 8/6/2019 BCS - Access Exercise

    34/49

    Database Exercise 3 Making Data Entry Forms

    Page 7 of 14

    Choose the Binoculars 1 icon

    Click finish

    Save the form and switch to Form View to check the appearance of your form.

    Now add buttons for each of the following functions

    Go To First Record

    Go To Previous Record

    Go To Next Record

    Go To Last Record

    Add New Record (from the Record Operations section)

    Insert a Close button but this time use a text label rather than an icon

  • 8/6/2019 BCS - Access Exercise

    35/49

    Database Exercise 3 Making Data Entry Forms

    Page 8 of 14

    Choose Close Form from the Form Operations section

    Select the Text radio button

    Save the form and switch to Form View to check the appearance of your form.

    Test that each button works

    Do not worry if all the buttons are not the same size at this stage

  • 8/6/2019 BCS - Access Exercise

    36/49

    Database Exercise 3 Making Data Entry Forms

    Page 9 of 14

    Setting all of the buttons to equal size, spacing and alignment

    It is often difficult to accurately arrange the buttons of fields on a form by eye.

    Fortunately Access has built in features for achieving this

    Working in Design view select all of the buttons which you want to align together

    From the format menu select the Size option

  • 8/6/2019 BCS - Access Exercise

    37/49

    Database Exercise 3 Making Data Entry Forms

    Page 10 of 14

    You will need to repeat this step to get the vertical and horizontal sizes to be equal

    Next choose the horizontal spacing option and make the spacing equal

    Finally choose the alignment option and set this accordingly

  • 8/6/2019 BCS - Access Exercise

    38/49

  • 8/6/2019 BCS - Access Exercise

    39/49

    Database Exercise 3 Making Data Entry Forms

    Page 12 of 14

    Could the buttons be bigger or smaller?

    Could the buttons be in a better position?

    Could the colour scheme be changed?

    Should there be more instructions on the screen

    Should any of the data entry fields be bigger or smaller?

    Write a written evaluation to answer these questions and carry out any improvements

    necessary using screen dumps to show how you have changed the form for the better.

    Save your form

    Extension activities form based on tblMembers

    Using the techniques that you used for making the form frmVideos, make a form based on

    the members table

    Call the form frmMembers

    Test the form using the same criteria as for the Vidoes form

    Extension activities adding pictures to the fields

    Add a Picture field that table tblVideo using the data type OLE object

  • 8/6/2019 BCS - Access Exercise

    40/49

    Database Exercise 3 Making Data Entry Forms

    Page 13 of 14

    Working in design view add the picture field to the form frmVideos

    In Design view change the size mode of the pictures to Stretch

    Working in data sheet view copy and paste a picture found on the internet into the picture

    field. Note that you cannot enter the pictures directly into the table you must use the

    form.

  • 8/6/2019 BCS - Access Exercise

    41/49

    Database Exercise 3 Making Data Entry Forms

    Page 14 of 14

    Now repeat this process for the members table and form (you will need to get some

    pictures of members)

  • 8/6/2019 BCS - Access Exercise

    42/49

    Database Exercise 4

    Database reports

    Learning outcomes

    You will appreciate that, whilst it is possible to print the contents of a query ortable directly, there is little control over the format and layout of the presentation.

    It is better to use Access reports in order to present information in an attractive and

    controlled format.

    You will be able to produce reports based on tables or queries and group the

    information generated in useful ways using a report.

  • 8/6/2019 BCS - Access Exercise

    43/49

    Database Exercise 4 Database reports

    Page 1 of 7

    Reports are usually based on tables or queries. Whilst it is possible to print the contents of

    a query or table directly there is little control over the format and layout of the

    presentation. In order to present information in an attractive and controlled format in

    Access it is better to use Access reports. Using reports makes it easier to change the font

    style and size and add clipart or scanned images.

    It is also possible to group the information shown in a report in useful ways.

    For example compare the following query and report

    Query Output Listing films rated 15

    Report Output Listing films rated 15 (based on the same query)

  • 8/6/2019 BCS - Access Exercise

    44/49

    Database Exercise 4 Database reports

    Page 2 of 7

    In the report it is possible to add a suitable title and picture and include your name and

    other information.

    Locate the file Video1.mdb, which has the queries in it that you produced in a previous

    exercise.

    Double click the file in order to open MS Access

    Create a new query including the fields Title, Category and Certificate query and

    examine it to see what information it holds.

    Save the query as qryFilmsCategoryCert

    Switch to datasheet view to see the result of your query.

  • 8/6/2019 BCS - Access Exercise

    45/49

    Database Exercise 4 Database reports

    Page 3 of 7

    You are now going to present the same information using Reports.

    In the database window click on Report tab .

    Click on New .

    Click on the Report Wizard and, using down arrow, select the query named

    qryFilmsCategoryCert

    Click OK.

    Next select the fields that you want included in the report. Using the double arrow, move

    all of the fields into second column.

  • 8/6/2019 BCS - Access Exercise

    46/49

    Database Exercise 4 Database reports

    Page 4 of 7

    Click Next

    In the next dialogue you will have the option to group the information in the report.

    Select Category and the top arrow in order to group by this field.

    Click Next

  • 8/6/2019 BCS - Access Exercise

    47/49

    Database Exercise 4 Database reports

    Page 5 of 7

    In the next dialogue you will have the option to specify any fields that you want to order

    in alphabetical order.

    From the drop down list choose Title .

    Accept default setting

    Click Next

  • 8/6/2019 BCS - Access Exercise

    48/49

    Database Exercise 4 Database reports

    Page 6 of 7

    Click on Soft Gray for style of report

    Click Next

    In the final step, you name your report. Replace qry with rpt at the start of the filename.

    You want to preview the report so leave this setting as it is.

    Click Finish.

    You need to make some modifications. Switch to Design View

    Click on Sorting and Grouping icon in toolbar and change Rating to descending order.

  • 8/6/2019 BCS - Access Exercise

    49/49

    Database Exercise 4 Database reports

    Close the Sorting and Grouping dialogue box.

    Change the title heading from ascending to descending

    Switch back to data sheet view to view the results of the change

    Switch back to design view

    Set the Title field list order back to ascending

    Switch back to design view

    Working in design view, note that the label at the top of the report is the same as the file

    name that you used.

    Edit the text label at the top of the report to a more sensible and friendly name

    Save your changes and close the report