Access 2010 Intro

26
Copyright 2010 West Virginia University Introduction to  Access 2010 Technical Support Services Office of Information Technology, West Virginia University OIT Help Desk (304) 293-4444, [email protected] Workshop Materials: oit.wvu.edu/t raining/classmat/db/ OIT Technical Support Services Last Revised: December 16, 2010

description

This material is for learning introductory part of Microsoft Access 2010.

Transcript of Access 2010 Intro

  • Copyright 2010 West Virginia University

    Introduction to Access 2010

    Technical Support Services Office of Information Technology, West Virginia University

    OIT Help Desk (304) 293-4444, [email protected] Workshop Materials: oit.wvu.edu/training/classmat/db/

    OIT Technical Support Services Last Revised: December 16, 2010

  • 2 OIT Technical Support Services

  • Introduction to Access 2007 3

    Contents Contents .............................................................................................................. 3 Getting Started .................................................................................................... 4

    What is a database/relational database? ......................................................... 4 Database applications ..................................................................................... 4

    Access Environment .......................................................................................... 5 Starting Access ................................................................................................ 5 Opening an Access Database ......................................................................... 6 Database window ............................................................................................ 6 Ribbons and Tabs ........................................................................................... 7 Navigation Pane .............................................................................................. 9 Types of Objects .............................................................................................. 9

    Table Basics ...................................................................................................... 10 Open a table .................................................................................................. 10 Navigate to records ....................................................................................... 10 Edit records in a table .................................................................................... 11 Add records to a table ................................................................................... 11 Sort records ................................................................................................... 12 Filter records .................................................................................................. 12

    Inside Access .................................................................................................... 13 Design View ................................................................................................... 14 Types of Fields (data types) .......................................................................... 14 Modifying the table structure.......................................................................... 17 Looking at Lookup Properties ........................................................................ 17

    View & Navigate Records with a Form ............................................................ 21 The Form tool ................................................................................................ 21 Create a basic form ....................................................................................... 21 Create a form using the Form Wizard ............................................................ 22

    Working with Reports ....................................................................................... 23 The Report tool .............................................................................................. 23 Creating a simple report ................................................................................ 23 Using Layout View to touch up a report ......................................................... 25

  • 4 OIT Technical Support Services

    Getting Started

    What is a database/relational database? Microsoft Office Access is a database management system that provides a graphical user interface for creating and maintaining relational databases. A relational database is a database management system in which data is stored in the form of tables, and the relationship among the data is also stored in the form of tables. Relational databases are the most common kind of database in use today.

    Database applications Access is commonly used for small-scale applications, such as you would find within departments of large institutions. It is best used by individuals or small groups of people. In addition to its ease of use in designing and building a database from scratch, Access also features a variety of pre-built database solutions. You can use these applications to track contacts, events, issues, assets, and tasks or you can treat them like templates

  • Introduction to Access 2007 5

    Access Environment

    Starting Access There are a variety of ways to start Access. Here is a basic way that will work in our OIT training lab:

    1. Click Start on the Windows task bar 2. Select All Programs and navigate to the Microsoft Office menu item 3. When you move your pointer over Microsoft Office, a sub-menu of Office

    components and tools will appear to one side 4. Click on Microsoft Office Access 2010

    When you start Access 2010 this way, you will be presented with a Getting Started with Microsoft Office Access page. From here you can create a new database, open an existing database, or view content from Microsoft Office Online.

  • 6 OIT Technical Support Services

    Opening an Access Database A new feature of Access 2010 is the addition of a File tab or ribbon, which replaces most of the functions previously found in the Office Button.

    1. In the File ribbon, click the Open icon to bring up the Open dialog box. 2. In the Open dialog box, navigate to the location on your computer where the

    Faculty.accdb file resides (your instructor will tell you where to look). 3. Select the Faculty.accdb file and click on the Open command button that is on

    the lower-right of the dialog box. 4. A Database window, similar to the one below, should appear.

    Database window Following is an illustration of a typical Access database window with some of the key components labeled:

    1. Quick Access Toolbar this is a small area that allows one-click access to

    common commands such as Save, Undo and Redo. 2. Tabs command tabs include File, Home, Create, External Data, and

    Database Tools. Note also that in certain circumstances you may also see Contextual tabs, such as Table Tools, which is just to the left of the arrow. Contextual tabs often include sub-tabs.

    3. The Ribbon is a replacement for menus and toolbars, and it provides the main command interface in Access 2007. It consolidates, in one place, those tasks or entry points that used to require menus, toolbars, task panes, and other user interface components. The Ribbon contains a series of command tabs: Home, Create, External Data, and Database Tools.

  • Introduction to Access 2007 7

    4. Navigation pane contains the names of your database objects, such as tables, forms, reports, pages, etc. This replaces the Database window used by previous versions of Access.

    5. Tabbed documents in place of overlapping windows in previous versions of Access, database objects are now displayed as tabbed documents.

    6. Record navigation controls this player style control lets you move between records, add a new record, and find text in a document.

    Ribbons and Tabs The Ribbon is a new feature that first appeared in Access 2007. Made up of tabs, groups, and commands, it is designed to help you quickly find the commands that you need to complete a task. Commands are organized in logical groups, which are collected together under tabs. Each tab relates to a type of activity. As a way to reduce clutter, some tabs are only shown when needed, for example a Design tab will appear when you start to create a table or form.

    File Tab New to Access 2010, the File tab displays as an entire window with commands running down the left side.

    The File tab provides what is called a Backstage view. It includes all of the document- and file-related commands, including Info, Save, Save As, Open, Close, Recent, New, Print, and Save & Publish.

    Home Tab This general-purpose tab controls your view of the database, traditional edit functions, as well as record manipulation tools.

  • 8 OIT Technical Support Services

    Views sets the view of the tabbed document to Form, Datasheet, Layout, or Design

    Clipboard holds icons for Cut, Copy, Paste, and Form Painter

    Sort & Filter perform column sorts and apply different types of filters

    Records contains commands to refresh, add, save, and delete records, as well as calculating sums and spell-checking

    Find perform find/replace operations, go-to, or selection tasks

    Text Formatting font-related effects, such as bold, italics, font color, text alignment. This is also where you can add or modify gridlines and themes

    Create Tab Use the Create tab to create basic Access components, such as tables, queries, forms, and reports.

    External Data Tab The External Data tab helps you to import and export data.

    Import & Link allows you to import data from Excel, Access, and a variety of text formats.

    Export allows you to export your data to Excel, Adobe PDF, Word, and other formats, as well as perform merge operations with Word.

    Collect Data provides tools that let you create and manage emails to be used for data collection forms

  • Introduction to Access 2007 9

    Database Tools Tab The Database Tools tab lets you work with Visual Basic and Macros; display relationships, properties and object dependencies; document and analyze the database; move data; and perform miscellaneous functions.

    Navigation Pane The Navigation Pane is a central location from which you can view and access database objects (more on objects below) such as tables, queries, forms and reports. The Navigation Pane in Access 2007 replaces the Database Window of previous versions.

    For example, if you want to open a table in Design view or run a report, you can perform those tasks in the Navigation Pane. You can change and customize the layout of the Navigation Pane to sort and display your database objects in different ways, such as by object type, categories, and dates.

    Types of Objects Major database components in Access are referred to as database objects. The four major types of database objects in Access are tables, queries, forms, and reports.

    Tables A Table is an object that you define and use to store data. Ideally, each table contains information (in the form of records) about a particular subject. Tables contain fields that store different kinds of data, such as names and addresses.

    Queries A Query is an object that provides a custom view of data from one or more tables (e.g., all students from New Jersey). In addition, you can define queries to select, update, insert, or delete data.

    Forms A Form is an object designed primarily for data input or display. A form can be used to customize the presentation of data.

    Reports A Report is an object designed for formatting, calculating, printing, and summarizing selected data. You can view a report on your screen before you print it.

  • 10 OIT Technical Support Services

    Table Basics

    Open a table The sample database that we will work with in this class is called Faculty. It consists of a Contacts-style database of faculty names, addresses, and miscellaneous department information. Data in the table is organized in a format of rows and columns. The information in a row is referred to as a record. Each vertical column, called a field, describes a record element, such as Faculty ID, First Name, or E-mail Address.

    Navigate to records If you use your mouse pointer to click in the blank square to the left of a row, you will highlight and select one record. Try this for the record with ID #5, Kathryn Rogers. When you select record #5, note the record navigation panel at the bottom of the datasheet displays that you are on record 5 of 57. Record navigation in Access uses a standard interface, like the one pictured below:

    1. go to first record 2. go to previous record 3. go to next record 4. go to last record 5. current record 6. total number of records 7. create new record

    Find a record The Find command is on the Home tab. It looks like a pair of binoculars. This command has many features, letting you search specific fields.

    Lets use it to find the last name Guzman in the Faculty table: 1. Highlight the Last Name field at the top of the Faculty table by left-clicking on it. 2. Click on the binoculars in the Find group of the Home tab. 3. In the Find and Replace dialog box, make sure the Find tab is selected. In the

    Find What: text box, type the name Guzman and click the Find Next command button.

  • Introduction to Access 2007 11

    4. Note that the Find and Replace dialog box remains in view, but the data sheet beneath jumps down and places a selection field around the name Guzman.

    5. Note also the list features in the Find and Replace dialog box: recent searches are saved and can be recalled, you can use the Look In list box to expand the search to the entire table, and you can modify other aspects of the search

    Edit records in a table To edit a record in a table, you need only place your cursor in a field and double-click with the left mouse button. Emily Guzmans E-mail Address has a mistake it says doggit.edu but its supposed to be dodgit.edu. Make the correction in her E-mail Address field and then press Tab or hit Enter.

    Access automatically saves the record you are adding or editing as soon as you move the insertion point to a different record or if you close the form or datasheet you are working on.

    Once you have made the change and moved to another field, the information has been modified in the table. The Save command is not used to save changes to your data in Access it is only there to save changes to the format and layout of your tables. Note that when you change the data, the Undo key in the Quick Access Toolbar will let you undo a recent change.

    Add records to a table You can add a new record to your table directly in the datasheet view. If you navigate down to the last record, you will notice that the next row which is blank has an asterisk (*) in front of it. This is the standard symbol for a new record. You can also get to the new record row by several other ways:

    By clicking on the new icon in the Records group of the Home tab

    By using the tab key to tab past the last field in the last record (this is a handy data entry feature)

    By clicking on the New (blank) record icon in the record navigation panel at the bottom of the datasheet.

    Type in the new record 1. Tab to the first field ID if your insertion point is elsewhere. Note the

    highlighted frame around the field, which indicates it is your active field. In this table, the ID field is an automatically generated AutoNumber (more on this later). This means that Access will control the numbering sequence of ID for you. Press tab twice (once to move to the next field Company and once to bypass that field and go on to the next field.

    2. In the Last Name field, type in Newby and tab to the First Name field. Fill in the rest of the record with this information:

  • 12 OIT Technical Support Services

    First Name: John E-mail Address: [email protected] Date of Birth: 4/23/1966 ID Number: 5673 Faculty ID: 5472 Department: Computer Science Faculty Type: Lecturer Office: 1013 Ebcdic Education: Ph.D. School/Program Name: Arts and Sciences Chair: (leave box blank)

    Note that there are additional fields as well. For other records, some of these fields are blank and some are not. Dont worry about these this isnt a typing or data entry class.

    Sort records In Access, you can sort or rearrange the records in a way that makes it easier for you to understand your data. The default sort order for records is by their primary key. In this case, the primary key is ID, which is a number.

    A simple sort 1. Identify a field on which you would like to

    sort. In this example, lets sort by Last Name. To the right of the field title is a downward-pointing arrow. Click this arrow to display a sort/filter shortcut menu.

    2. This menu can be quite versatile, allowing you not only to sort, but also to apply specific text filters. For now, lets just do a simple A-to-Z sort of the last name: click Sort A to Z

    3. Note that the datasheet now shows records sorted alphabetically by Last Name.

    To remove a sort order from a table, query, or form, on the Home tab, in the Sort & Filter group, click Clear All Sorts.

    Filter records A record filter allows you to narrow or filter the display of information down to records that meet a certain criteria. For example, a department field in the faculty table can currently be one of the following:

    Chemistry

  • Introduction to Access 2007 13

    Computer Science Geology Mathematics Physics

    We could apply a filter that would let us display any or all of those departments. Note that a filter is a lot like a Query, except that a filter shows your results on the fly, while a Query can be incorporated into a subsequent record management procedure, such as a Form or Report.

    A simple filter Identify a field on which you would like to apply a filter. In this example, lets filter the Department field to display only Chemistry faculty.

    1. To the right of the Department field title is a downward-pointing arrow. Click this arrow to display a sort/filter shortcut menu. The filter portion is beneath the sort commands.

    2. By default, all of the Departments are selected to be viewed. Click on the Select All checkbox to unselect all of the Departments.

    3. Click the checkbox in front of the Chemistry department to select just that department.

    4. Click the OK command button. After you click OK, the Faculty table display will be filtered to show only Chemistry Department faculty. To remove a filter from a table, on the Home tab, in the Sort & Filter group, click the Toggle Filter .button.

    Back in the Sort & Filter shortcut menu, notice the filter for Blanks this filter can be a handy way to scan for missing data!

    Inside Access So far, youve looked at an Access table at the datasheet level, where you can view and modify records. While designing a new database is the subject of another Access tutorial, its useful for you to become acquainted with some fundamental software features and terminology.

  • 14 OIT Technical Support Services

    Design View Underlying the datasheet view of any Access table is the Design View, where you can

    view and modify the tables structure. You can look at the data type for each field (e.g., whether it is a text or numeric field), find input masks, or see if the table uses any lookup fields.

    Types of Fields (data types) Access 2007 supports ten different data types.

    Attachment This field is used for storing binary files, such as digital photos, that you cannot read by using a text editor. Multiple files can be attached per record. This data type is new to Access 2007.

    AutoNumber Numbers that are automatically generated for each record. An incremented AutoNumber field is a convenient way to create a unique identifier called a primary key.

    Currency Monetary values.

    DateTime Use this field for storing dates and time values. Each stored value includes both a date component and a time component.

    Hyperlink Hyperlinks provide single-click access to a URL, such as an e-mail address or a web page.

    Memo Use this field for long blocks of text (more than 255 characters), as well as for text that uses rich text formatting. An example of a Memo field might be a detailed course description.

    Number Numeric values (integers or fractional) that will be used in calculations. Note that there is a separate data type for currency.

    OLE Object (Object Linking and Embedding) This is a protocol that lets you create a field that consists of an embedded link to an OLE object, such as a Windows Paint picture, and Excel spreadsheet, or a Word document. The Attachment field (discussed above) is now recommended over the use of OLE Object.

    Text This general-purpose field type can be any short (up to 255 characters), alphanumeric value, such as a last name or a street address.

    Yes/No

  • Introduction to Access 2007 15

    Boolean datatype having one of two values (e.g., paid/unpaid, or active/inactive) Lookup Wizard

    There really are just ten data types. However, when you set data types in Design View, youll notice that theres an 11th choice, called Lookup Wizard. The Lookup Wizard is not an actual data type. However, you can use the Lookup Wizard to create lookup fields, so that the user will enter only the proper types of data in the table field.

    Table Design data types and field properties

    1. Field Name can be up to 64 characters long, including any combination of

    letters, number and special characters (except period, exclamation mark, accent grave, or brackets)

    2. Data Type displays the field data type via a dropdown list (see #4 below) 3. Description entering a description property for a field helps document your

    application. 4. List of data types dropdown when you place the mouse pointer over the data

    type for a field, a dropdown arrow appears on the right side of the column. Clicking on this arrow will display a list of data types.

    5. Primary key indicator key symbol, which denotes the primary key field of a table

    Primary Keys A primary key is a field (or set of fields) that uniquely identifies a record in a table. For example, a list of faculty could use an employee number or some other unique identifier.

    Note that although a Social Security Number is considered a unique identifier, privacy concerns discourage its use.

  • 16 OIT Technical Support Services

    Designating a field as a primary key ensures that you do not enter the same record more than once; primary keys do not permit duplicate entries within the database.

    Field Properties Beneath the Table Design panel is a Field Properties panel where you can further define and control a fields attributes and appearance. The list of specific properties can vary, depending upon the related data type. For example a Date/Time data field wont have an associated Field Size.

    Some field properties, such as Field Size, let you type in a specific value. Other field properties, such as Default Value or Required, will display an expression builder or a selection list when you click in their spaces. Its difficult to cover all of the possible field properties in an introductory tutorial. Following are some useful field properties:

    Format Customizes the way that the field appears by default when it is displayed or printed. Although format is dependent upon the data type, you should be aware that there are special formats to help you display date/times, numbers & currency, text, and yes/no data types.

    Input Mask An input mask can help you with data entry, providing you with a template or mask for data such as telephone numbers, social security, or ZIP codes.

    Validation Rule An expression that limits the values that can be entered in the field. For example, you can set rules to control what kind of character (e.g., numeral or letter) and how many characters can be entered. When data is entered that violates the rule, you can supply a Validation Text message to inform the user.

    Required Assures that a necessary and important data field cannot be left blank.

  • Introduction to Access 2007 17

    Modifying the table structure Once a database has been created, its still possible to make modifications to the underlying structure. You can insert, delete, and rename data fields (i.e., columns).

    Backing up the database Before you modify design elements or field properties in a database, you should make sure that you can undo your changes in the event that some unforeseen problem might arise. One of the most important things you can do to protect yourself (and your data) is to create backups of your database. Access has a Back Up Database command its just not in the Database Tools tab, where you might expect it to be. To access the Back Up Database command:

    1. Click on the Office Button 2. Click on Manage from its menu. 3. Click on Back Up Database.

    When you run the Back Up Database command, youll see a Save As dialog box, which lets you save a copy of your active database with the current date appended as part of the filename.

    Deleting a field from a table You can delete a field from your table, but it is up to you to remember if any database objects (such as queries) contain references to the deleted field. If one of your objects contains a reference (e.g., a bound control) to the deleted field, Access wont be able to find the data, and it will generate an error message.

    You dont have to be in Design View in order to insert, delete, or rename a data field. While in datasheet view of the Faculty table, lets delete the Company field (located between ID and Last Name)..

    1. Place the mouse pointer over the column header (i.e., directly over the word Company) and right click with the mouse button.

    2. Click on the Delete Column command, near the bottom of the shortcut menu. 3. A Microsoft Office Access dialog box will appear, asking you to confirm that you

    want to permanently delete the field. Click Yes. 4. The Company field has been deleted from the table.

    Looking at Lookup Properties When we were looking at the Field Properties panel, you may have noticed that there was a Lookup tab in addition to the General tab. Initially, theres no information in that Lookup tab you must first activate it and associate it with a field by using the Lookup Wizard.

  • 18 OIT Technical Support Services

    Lookups are great for: Speeding up data entry its usually much easier to pick from a list of items

    than it is to actually type in the item name Assuring data integrity if you plan on making special use of data in a field,

    such as being able to break it down into categories, that data must be uniform and accurate. The best way to assure this is to control its correct entry.

    Creating a Lookup list The data field Department in the Faculty table is an excellent candidate for a Lookup list. We want these values to be uniform and correctly spelled:

    Chemistry Computer Science Geology Mathematics Physics

    Were going to do our modification in the Design View of the Faculty table: 1. Right-click your mouse pointer

    over Faculty in the Tables section of the Navigation Pane. In the shortcut menu, click on Design View. You will see the Faculty table in the tabbed documents view displayed in Design View.

    2. Locate the Department field (between Faculty ID and Faculty Type).

    3. Click your mouse pointer in the Data Type column for Department. Then click the List Arrow, which appears on the right side of the box.

    4. In the List of data types dropdown, click on Lookup Wizard, which is at the bottom of the list. A Lookup Wizard dialog will appear.

  • Introduction to Access 2007 19

    5. In this dialog box, you are asked how you want your lookup column to get its values. Click on the radio button that says I will type in the values that I want.

    Click the Next command button at the bottom.

    6. The next page of the Lookup Wizard asks you to enter the number of columns that you want in the list. The default is 1, which is what we want.

    Below that, type in the list of departments in the Col1 column. Use the Tab key to go to the next blank row after typing in a value. (If you inadvertently get to the next dialog page before you are done, you can click the Back command button) Click the Next command button at the bottom.

    7. The final step in the Lookup Wizard asks you to type in a label for your lookup column. The default, Department, is acceptable. Were not storing multiple values for this lookup, so do not place a check in the box labeled Allow Multiple Values. Click the Finish command button.

    When you have completed these steps, youll notice that nothing appears to have changed Department still has a data type of Text. Down below, in the Field Properties section, click on the Lookup tab. Notice that new fields have now been added to the Lookup tab. At this point, can still to type an entirely different department name directly into this field. If you want to prevent this, go back to the Lookup tab in Field Properties and set the property for Limit to List as Yes. Now the Department fields will accept text only if it matches one of the pre-existing field choices.

  • 20 OIT Technical Support Services

    Save your recent changes. Click the Save icon on the Quick Access Toolbar. Go back to the Datasheet View of the Faculty table and click on the Department field for one of the records. You will see that a selection list arrow now appears on the right side of the field, allowing you to pick a Department name from the list. You dont need to rely on your mouse pointer to make a selection from the list. You can type in the leading letter(s) of a list item to select it. As an example, if you are in the Department field, you can type m and hit tab to select Mathematics. If you have identical leader letters (e.g., Chemistry and Computer Science), you would type two letters (e.g., co) in order to select the second item. Can you think of any other fields in the Faculty table where a Lookup could help speed the data entry process and maintain consistency?

    If you want to add a new department (or change an existing one), dont forget to update the Row Source field in your Lookup!

  • Introduction to Access 2007 21

    View & Navigate Records with a Form A form is a database object that you can use to enter, edit, or display data from a table or a query. Think of forms as windows through which people see and reach your database. An effective form speeds the use of your database, because people don't have to search for what they need.

    The Form tool Form tools are found in their own Forms group on the Create tab. Following is a description of some of the main form tools:

    Form With the Form tool, you can create a form with a single mouse-click. When you use this tool, all the fields from the underlying data source are placed on the form. You can begin using the new form immediately, or you can modify it in Layout view or Design view to better suit your needs.

    Split Form A split form is a new feature in Access 2007 that gives you two views of the data at the same time a Form view and a Datasheet view. The two views are connected to the same data source and are synchronized with each other at all times.

    Multiple Items The basic Form tool creates forms that display a single record at a time. The Multiple Items tool creates a form where multiple records are displayed.

    Form Wizard The Form Wizard (which is hiding within More Forms) lets you determine what fields will appear on your form, as well as how your data is grouped and sorted.

    There are other form tools, but their use requires an understanding of form design concepts, which are beyond the scope of this document.

    Create a basic form 1. In the Navigation Pane, click on the table that you want to see on your form.

    For this exercise, well continue using the Faculty table. 2. On the Create tab, in the Forms group, click Form.

    Access creates a form that displays every field in a record. This form starts out in design view, meaning that you can make design changes to the form while it is displaying data. The form is a friendlier version of the data table you can make changes to fields by re-typing the information, or you could use the familiar record navigation tool at the bottom of the form to navigate, search for information, or add a new record.

    If you have completed the exercise above for adding a Lookup list, you should notice that the Department field in your form uses that Lookup list, and that it does not allow you to enter a department name that is not already on that list!

  • 22 OIT Technical Support Services

    Create a form using the Form Wizard As you have seen from all of the data fields in the Faculty table, there are a number of fields that are blank and not being used in this database. Rather than deleting all of these unused fields (somewhere down the road, we may actually want them), we can design a form that displays just those data fields that we want to work with. This is a job for the Forms Wizard.

    1. On the Create tab, in the Forms group, click More Forms. 2. Select the Form Wizard icon from the top of the More Forms menu. 3. In the first Form Wizard panel, you must select the Table/Query that you will

    use. By clicking on the selection arrow to the right of the Tables/Queries box, select Table: Faculty.

    4. The next step involves the selection of fields from the list of Available Fields on the left side and placing them in the Selected Fields box on the right side by clicking the single selection button. These are the data fields we will like to use (if you select them in this order, that is how theyll appear later):

    ID Faculty ID First Name Last Name E-mail Address Office Phone Department Faculty Type

    5. When you have completed the selection process, click the Next button to continue. 6. The second Form Wizard panel asks you to select the type of layout you would

    like. The preview window on the left will display each layout for you as you select the various buttons (try this). Well stick with the default Columnar form, so select that button and click Next.

    7. The third Form Wizard panel asks you to select a style for the display of your form. Again, the preview window on the right will show what your selection will look like. Choose a style that you like, and click Next.

    8. The fourth and final Form Wizard panel asks you to type in a name for your form. If the name hasnt been used yet, the default will be the name of the table or query on which you based the form. Well call our new form Faculty List. You then have the choice of going directly to your form or going into Design View to make further changes. Were done, so select the first choice, and click Finish.

    Take a moment to look over your new form. Note that it is just like the previous form that you created. You can navigate, search for information, or add a new record, just like in the previous form. The difference is that this form includes only the subset of data fields that you want to see and work with. If you add a new record using this form, you will obviously be leaving blank the many other data fields that exist for this record.

  • Introduction to Access 2007 23

    Working with Reports Reports are the best way to create a printed copy of information that is extracted or calculated from data in your database. With a report, you can compare, summarize, subtotal, and total large sets of data. You can also use reports to present your output in a useful and attractive layout. A couple of uses for reports using the faculty data that weve been working with so far might be a phone directory or mailing labels.

    The Report tool Report tools are found in their own Reports group on the Create tab. Following is a description of some of the main report tools:

    Report With the Report tool, you can create a report with a single mouse-click. It will take the data from the current table, form or query that you have been working with and automatically create a report in which you can then edit the features.

    Labels The Labels wizard will let you create standard or custom labels using a variety of label formats from a variety of manufacturers.

    Blank Report Create a new blank report, where you can use drag and drop to place the various components and data fields.

    Report Wizard The Report Wizard guides you through the creation of simple, customizable reports.

    Report Design Create a new blank report in Design View, where you can use advanced design tools to create custom reports.

    Creating a simple report This exercise will demonstrate how to use the Report Wizard tool to create a departmental phone directory. With that goal in mind, we will once again use the faculty table. Our simple directory will be organized by department, with faculty sorted by last name, followed by their office phone number.

    1. On the Create tab, in the Reports group, click Report Wizard. 2. In the first Report Wizard panel, you must select the Table/Query that you will

    use. By clicking on the selection arrow to the right of the Tables/Queries box, select Table: Faculty

  • 24 OIT Technical Support Services

    3. The next step involves the selection of fields from the list of Available Fields on the left side and placing them in the Selected Fields box on the right side by clicking the single selection button . These are the data fields we would like to use (this isnt the order we eventually want to place them in):

    Last Name First Name Department Office Phone

    4. When you have completed the selection process, click the Next button to continue.

    5. The second Report Wizard panel asks if you want to add any grouping levels. Since we want to organize our phone directory by department, select Department in the preview window on the left and click the single selection button. The preview window on the right now shows Department as the first item. Click the Next button to continue.

    6. The third Report Wizard panel asks what sort order you would like for detail records. Note that you can sort records by up to four fields. Since its not unusual to have two people with the same last name, well sort by Last Name (keep the default ascending order) and by First Name. After making the sort selections, click the Next button to continue.

    7. The fourth Report Wizard panel asks you to select a layout for the report. The preview window on the left will show you a rough idea of what your choice will look like.

    a. The default Stepped layout will work fine. b. Since were using a relatively small number of data fields, the default

    Portrait orientation should also work for us. c. As an added measure, be sure theres a check mark where it says to

    Adjust the field width so all fields fit on a page. d. Click the Next button to continue.

    8. The fifth Report Wizard panel asks you to select a style for the report. Again, the preview window on the right will show what your selection will look like. Choose a style that you like, and click Next.

    9. The sixth and final Report Wizard panel asks you to type in a name for your report. If the name hasnt been used yet, the default will be the name of the table or query on which you based the report. Well call our new report Faculty Directory. You then have the choice of going directly to your report or going into Design View to make further changes. Were done, so select the first choice (Preview the report), and click Finish.

    10. Your report should now be displayed in a Print Preview layout. This layout is probably not quite right, but we cant fix it here. Click on the Close Print Preview button (on the right side of the ribbon) to turn off this view.

  • Introduction to Access 2007 25

    Using Layout View to touch up a report When you previewed the completed report, there were some formatting problems:

    Long department names, like Computer Science, were truncated There was probably too much space being taken up by the Last Name and First

    Name fields, leaving Office Phone truncated and only partially visible on the right.

    These problems can be remedied in Layout View. 1. On the Home tab, click the down arrow at the bottom of the Views icon, which is

    at the far left side of the ribbon. 2. Click the Layout View icon from the submenu.

    This displays your report in Layout View.

    3. Click over the area on your report where the Department header appears (see arrow above). This causes field boundaries (broken-lined box) to appear down the Department column.

    4. Place your mouse pointer over the right side of the column boundary until the cursor changes into a double-headed arrow.

    5. With the double-headed arrow over the column boundary, left-click and drag it slowly to the right, until you can see the entire Computer Science department header (its the widest).

    6. You can use this same technique to click over the other headers (i.e., Last Name, First Name, and Office Phone) and resize them so that everything is now visible on the page.

    7. When you are done resizing the columns, you can switch back to Report View and admire your work.

    ContentsGetting StartedWhat is a database/relational database?Database applications

    Access EnvironmentStarting AccessOpening an Access DatabaseDatabase windowRibbons and TabsFile TabHome TabCreate TabExternal Data TabDatabase Tools Tab

    Navigation PaneTypes of Objects

    Table BasicsOpen a tableNavigate to recordsFind a record

    Edit records in a tableAdd records to a tableType in the new record

    Sort recordsA simple sort

    Filter recordsA simple filter

    Inside AccessDesign ViewTypes of Fields (data types)Table Design data types and field propertiesPrimary KeysField Properties

    Modifying the table structureBacking up the databaseDeleting a field from a table

    Looking at Lookup PropertiesCreating a Lookup list

    View & Navigate Records with a FormThe Form toolCreate a basic formCreate a form using the Form Wizard

    Working with ReportsThe Report toolCreating a simple reportUsing Layout View to touch up a report