Intermediate Microsoft Access 2010

Similar documents
Table of Contents COURSE OVERVIEW... 5

Microsoft Access II 1.) Opening a Saved Database Music Click the Options Enable this Content Click OK. *

Complete Quick Reference Summary

Database Design Lab: MS Access Queries

MIS Cases: Decision Making With Application Software, Second Edition. Database Glossary

Microsoft Access 2010

Access Review. 4. Save the table by clicking the Save icon in the Quick Access Toolbar or by pulling

Microsoft Access 2013

Microsoft Access 2013

Tutorial 2. Building a Database and Defining Table Relationships

Microsoft Access 2013

Introduction to Microsoft Access 2016

Microsoft Access 2007 Module 1

User Services Spring 2008 OBJECTIVES Introduction Getting Help Instructors

Index. B backing up 76 7

Using Microsoft Access

Rev. B 12/16/2015 Downers Grove Public Library Page 1 of 40

The specific steps to build Wooden Crafts database are here: 1. Create New Database. i. After opening Access, click Blank Desktop Database :

Getting started with Ms Access Getting Started. Primary Key Composite Key Foreign Key

Database Tables Lookup Wizard Relationships Forms Subforms Queries Reports

Contents. Creating Forms

Microsoft Access 2010

Objective 1: Familiarize yourself with basic database terms and definitions. Objective 2: Familiarize yourself with the Access environment.

Rev. C 11/09/2010 Downers Grove Public Library Page 1 of 41

AUSTIN COMMUNITY COLLEGE CONTINUING EDUCATION. INTRODUCTION TO DATABASE/FILE MANAGEMENT (Access Introduction) (12 hours) ITSW 1053 COURSE SYLLABUS

MODULE 5 DATABASES. Content

Microsoft Access XP (2002) Switchboards & Macros

Open. Select the database and click. Print. Set printing options using the dropdown menus, then click the

SEE GRADING CRITERIA AT THE BOTTOM. Database Tables Lookup Wizard Relationships Forms Queries Reports

INTRODUCTION ACCESS 2010

Microsoft Access 2010

Level 6 Relational Database Unit 3 Relational Database Development Environment National Council for Vocational Awards C30147 RELATIONAL DATABASE

Microsoft Access 2010

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Copyright 2009 Labyrinth Learning Not for Sale or Classroom Use LESSON 1. Designing a Relational Database

Administering a Database System

Microsoft Certified Application Specialist Exam Objectives Map

Microsoft Access Description

USING MICROSOFT ACCESS 2013 Guided Project 7-1

Access Intermediate

TECHNOLOGY COMPETENCY ASSESSMENT MODULE Microsoft Access

MS-Access : Objective Questions (MCQs) Set 1

Chapter 4: Single Table Form Lab

MS Access Let s begin by looking at the toolbar and menu of Access.

AVANTUS TRAINING PTE LTD

OBJECTIVES. Introduction to mycourses

Access 2016 Essentials Syllabus

Microsoft Access 2002 for Windows

Microsoft Excel 2010 Basic

AUSTIN COMMUNITY COLLEGE CONTINUING EDUCATION. INTERMEDIATE DATABASE/FILE AMANGEMENT (Access Intermediate) (12 hours) ITSW 1055 COURSE SYLLABUS

Microsoft Access XP (2002) - Forms. Navigation Wizards Custom Forms Combo Boxes Calculations in Forms Pictures Multitable Input Summary Operations

Preview New Features of Office 2007 Programs

Using Microsoft Word. Working With Objects

Microsoft PowerPoint 2016 Basics Unit 9 Final Review - Student Notes Directions: Fill in the blanks.

Englische Access 2016-Trainingsskripte für IT Seminare und EDV Schulungen als Word-Dokument zum Ausdrucken und fürs Intranet

INTRODUCTION... 1 UNDERSTANDING CELLS... 2 CELL CONTENT... 4

Navigating a Database Efficiently

These pages will help you get started with the Mazda Web Report System. Use the following options to find the information you need:

Microsoft Access 2007 Level 3

Microsoft Office Specialist Access 2016

User Services. WebCT Integrating Images OBJECTIVES

Microsoft Office 2010: Introductory Q&As Access Chapter 3

Introductory Exercises in Microsoft Access XP

POS Designer Utility

MIS 2502 Access 2007 Tutorial

Excel 2007 New Features Table of Contents

Microsoft Access 2016 Intro to Forms and Reports

course notes quick reference guide

When you pass Exam : Access 2010, you complete the requirements for the Microsoft Office Specialist (MOS) - Access 2010 certification.

User Guide. Web Intelligence Rich Client. Business Objects 4.1

Access Intermediate

Outlook 2010 One. Wednesday, August 7, 9-11 am. Agenda:

AVANTUS TRAINING PTE LTD

Working with Data in Microsoft Excel 2010

Chapter11 practice file folder. For more information, see Download the practice files in this book s Introduction.

Microsoft Word 2011 Tutorial

EXCEL BASICS: MICROSOFT OFFICE 2007

Office Applications II Lesson Objectives

Excel Tables and Pivot Tables

Quick Start Guide - Contents. Opening Word Locating Big Lottery Fund Templates The Word 2013 Screen... 3

SOFTWARE SKILLS BUILDERS

Access Tutorial 2 Building a Database and Defining Table Relationships

EVALUATION COPY. Unauthorized Reproduction or Distribution Prohibited

Word Module 5: Creating and Formatting Tables

Access Made Easy. Forms.

Excel 2016 Basics for Mac

EXCEL BASICS: MICROSOFT OFFICE 2010

Table of Contents Lesson 1: Introduction to the New Interface... 2 Lesson 2: Prepare to Work with Office

Excel 2013 Intermediate

Access: Using Forms for Data Entry and Editing

Productivity Tools Objectives 1

More Skills 12 Create Indexes and Establish a One-to-One Relationship. To complete this database, you will need the following file:

Microsoft Access 2007 Module 2

Basic Intro to ETO Results

Productivity Tools Objectives

Microsoft Access Basics

Access Macros & Advanced Topics

Office of Instructional Technology

New Perspectives on Microsoft Access Module 2: Building a Database and Defining Table Relationships

Access. Basics PRESENTED BY THE TECHNOLOGY TRAINERS OF THE MONROE COUNTY LIBRARY SYSTEM

Transcription:

OBJECTIVES Develop Field Properties Import Data from an Excel Spreadsheet & MS Access database Create Relationships Create a Form with a Subform Create Action Queries Create Command Buttons Create a Switchboard Create a Macro Use the new Microsoft Access 2010 Alternating Row colors in reports. In Report Layout View select an entire row. On the Format contextual tab in Report Layout Tools, in the Font section, select the Alternate Fill/Back Color command button to select an alternating row color. Instructors Spring 2012 Intermediate Microsoft Access 2010 Microsoft Access is a powerful tool to organize, manipulate and present data. New features in Access 2010 filters, and the new attachment and multi-valued fields will be covered. Topics will include developing field properties, importing an Excel spreadsheet and Microsoft Access tables, creating a lookup table and working with the Relationship Builder. Also included will be working with relational queries, commands on forms, creating a Master Switchboard and a macro. These exercises will allow participants to accomplish enhanced data analysis. Getting Help The ITS Help Desk is a service provided to all Mississippi State University students, staff, and faculty. The ITS consultants are available to help with various computer-related problems as well as provide answers to computer and technologyrelated questions. Visit the Web site at www.its.msstate.edu for handouts and resolutions to common computer problems. If you cannot find an answer to your question on the Web or you do not have access to the Internet, please call at 325-0631 (7:30 a.m. to 5:00 p.m. Monday through Friday). You may also contact the ITS Help Desk at 108 Allen Hall or by email at helpdesk@msstate.edu. Quan Chung qtc1@its.msstate.edu

Table of Contents What s New In Microsoft Access 2010 Microsoft Access 2010 Attachments... Microsoft Access 2010 Filtering... Quick Filtering... Filter by Selection... Filter by Form... Multi-Valued Fields... Initial Database SetUp Create Database... Import Data.... Default Date... Date Field Update on Change to Record... Relationships Relationships... 17 Lookup Table... 18 Relationship Builder... 23 Relational Query... 24 Form with Subform... 27 Action Queries Action Queries... Make-Table Query... Delete, Append Queries... Forms and Macros Basic Forms... Advanced Forms... Switchboard Manager... Macros... Microsoft Access 2010 Limits... 3 5 6 7 8 9 10 13 14 15 28 30 32 33 35 37 38 39 Attachments - Inserting Attachments One or more files can be attached in a single field. Example type files are image files and document files such as PDF files, sound files and other Microsoft Office files. A. More than one file can be attached to a field because Access is normalizing your data behind the scenes. B. The attachment feature is more efficient than OLE (Object Linking and Embedding) because the files are stored in their native formats. C. The Data Type must be set to Attachment. D. A maximum of 256 MB size per file for each attachment. In total you can have 2 GB of attachments. Assign a name to the Caption in Field Properties. The caption will show as the title name in Datasheet, Form and Report Views. In Design View assign your field an appropriate name like fldstuattachments. Change the Data Type to Attachment. 3. In Datasheet View double click in the field where you would like to add an attachment. When the Attachments dialog box opens, select the Add button. 2 3

4. Navigate to the file you wish to open and select it. Click Open. Click OK in the Attachments dialog box. 5. In the database it will indicate that one file has been attached. Add other gif, PDF, bmp, and SPSS files to the other cells in the attachment field. Filter by a Quick Filter Quick filters are available in MS Access 2010. Filters are available for all field types except OLE and Attachments. In datasheet view you can either select 1) the drop-down arrow to the right of the field name or 2) select a value in any field and select the Filter icon. All values for that field are displayed. To select one or several values from the dialog box: click on the Select All checkbox to unselect it, select the values you are interested in. Click OK. Attachments - Opening Attachments To open the attachment in the table, double click the cell with the attachment. Double click the file you want to open in the Attachments dialog box. The application in which the file was created will open provided your computer has the application. To select a range of values, select one of the Number Filters as shown. If working with text or dates, the filters will reflect this. In forms and reports if the attachment is a picture, the picture will display. For other types of attachments, an icon appears representing the type of file of the attachment. Test this out by creating a form and report based on tblstudents. (Attachments are only allowed in MS Access 2010, not previous versions of MS Access. ) In tables and forms attachments can be edited, removed or saved. In a report you can only save the attachment. Editing and saving is dependent on having the application. Filters vs Queries 3. There are visual cues that your records are being filtered. Filters are not as versatile as queries. Filters only store the filter command(s) while you are using them where as queries are reusable. The results of queries are separate database objects. Queries can be more sophisticated than filters. Queries can display only the columns you are interested in. 4 5

Filter by Selection Locate a specific value in a field. To locate all the other records with that same value, right click on the value. Selection commands become available. Filter by Form Use Filter by Form when you have more than one criteria you are searching for. Begin with a blank datasheet. Fill in all the fields you are searching on. In the Sort and Filter section on the Home tab, from the Advanced drop-down menu, select Filter By Form. Make your selection(s) on the datasheet. Select a value in a field and select one of the Selection commands from the ribbon. 3. Use the Or tab if you want to do a logical OR query. 4. To toggle between your selection and no selections click on the Toggle Filter button. 3. To toggle between your selection and no selections click on the Toggle Filter button. You can also choose different parts of a value, the first character(s), middle, or end character(s) before using the Selection commands. 5. When you are finished, select Clear All Filters from the Advanced drop-down menu. Advanced filtering takes you to the query grid where you can run select queries on one table. 6 7

Multi-Valued Fields One of the ways databases maintain data integrity is by having only one value stored in each cell in a field. MS Access 2010 will let you store more than one value in a field, however, you must enter data into multi-valued fields using a specific procedure. MS Accesss 2010 is actually managing multiple tables behind the scenes. A multi-valued field is best used when the multiple selection is obtained from a short list. Scenario The ITS department is having a technology fair for students. The students can sign up for several lectures to attend. For each student, reflect in the database, using a multi-valued field the lectures each student has signed up for. Create a supporting table that will hold all the values for the multi-valued list. For our example today we will use the table ITSTechFair. a.) Add the field, flditstechfair to tblstudents in Design View. b.) Assign Number to flditstechfair as the Data Type. c.) Change the Data Type to Lookup Wizard for this field. d.) Choose to Lookup the values in a table. e.) Choose Table: ITSTechFair as the table to provide the values for the lookup column. f.) Select all the fields. g.) Sort by ITSTechFairLecture. h.) Hide the key column. i.) Most Important: On the last step of the Lookup Wizard select Allow Multiple Values. Click Finish. Open Microsoft Access 2010 In the remainder of todays workshop we will learn several advanced features of Microsoft Access. First we will create a new database, then we will import one Microsoft Excel table and two Microsoft Access tables into it. The data will already be entered in these tables. Getting Started Window First we will create the file to hold the tables, forms, queries and reports we will be using for this project. Select the Blank Database icon under the New Blank Database header. In the right pane of the database, under Blank Database, in the FileName: textbox type in MSUStudentHealth. Click on the Browse icon. File New Database Window Browse to the Temp folder on the Desktop. Click OK. Documents Window 3. You can now enter multiple lectures into each cell of the flditstechfair field in the tblstudents table in Datasheet View. 4. You can use the multi-valued field in reports for the grouping value. The reports will group on each value allowed in a multivalued field. 3. 4. Right click on the Table1 tab and select Close. We will be importing all our tables today. Navigation Pane Select the drop-down button in the Navigation pane and change the Navigate to Category from Tables and Related Views to Object Type. 8 9

Importing A Data table into Microsoft Access from Microsoft Excel Data can easily be imported into Microsoft Access. Select the External Data tab. Click on the Excel button in the Import section. 5. Close table Major. Importing Data Tables into Microsoft Access From Another Database In the Get External Data - Excel Spreadsheet dialog box click on the Browse button. Select the file Major in the Temp folder on the Desktop. Click the Open button. When returned to the Get External Data dialog box, click OK. After the Excel file is imported into MS Access it will be used as a lookup table. Import the Visit and Student Information tables. Select the External Data tab. Click on the Access icon in the Import section. In the Get External Data - Access Database dialog box, Browse to the MSU102 Access database in the Temp folder on the Desktop and select it. Click Open. Click OK. 3. In the Import Spreadsheet Wizard: a. Select the radio button Show Worksheets. Click the Next button. b. c. d. e. Select the check box First Row Contains Column Headings. Click the Next button. Accept the defaults. Click the Next button. Click on Choose my own primary key and select Id, if not already chosen. Click the Next button. Accept the default name Major. Click the Finish button. Click the Close button. 3. In the Import Object dialog box, select the Student Information and Visit Information tables. Click OK. Click Close. The table titles will appear in the Navigation pane under Tables. 4. If you open the Design View and Data Sheet View of the Major Table they will appear as follows: Design View Datasheet View 10 11

The design view and datasheet view of these tables will appear as shown below. We will be creating a relationship between the primary Student Information table and the secondary Visit Information table. Default Date Student Information Design View A default date will be added to the Student Information table. The Student Information table already has a mask for the Date of Birth and Phone fields of the students. Datasheet View Open Student Information in Design View. Select the Updated field in the Field Name column. 3. Click in the Default Value box in the Field Properties section. 4. Click the Build button. Visit Information Design View Datasheet View The box that is displayed is called the Expression Builder. 5. Click the = sign. 6. Double-click the + next to Functions. 7. Single-click Built-In Functions. 8. Select Date/Time in the middle box. 9. Double click Date in the right-hand box. 10. Click OK. The Date setting will put the current date into the Updated field as the default value in Datasheet View. The user can override this entry and type another date if desired. Close the table and save changes. 12 13

To have the date field automatically update when a change is made to any field on the record you need to use Visual Basic in Microsoft Access 2010. Also, this can only be done in Form View. Create a form from the Student Information table. Use the Quick Form button on the Create tab. Rename the form UpdateRecord Change to Design View of the form. Open the Property Sheet for the form by double clicking on the square above and to the left of the Form Header. Advantages of a Relational Database There are two reasons to set relationships between tables. Either for a table lookup or to handle multiple occurrences of data. Table Lists & Lookups A field in one table can be used to look up data from a list in another table. This keeps from having to store the same data in multiple places. Only the key field from the lookup table is inserted into the main table. Using the Lookup wizard doesn t automatically assign the properties Enforce Referential Integrity or Cascade Update Related Fields. When needed these properties can be added in the Relationships window. When Cascade Update Related Fields is selected, if data is updated in the lookup table it will be updated throughout the table(s) it is linked to. Multiple Occurrence of Data Another reason to set a relation is to handle multiple occurrences of data. In our system design, there are multiple occurrences of visits that each student has had to the Student Health Center. Information about each visit should be entered on a separate line and in a separate table from the demographic data about each student. The two tables could be linked together by a field such as the students NetID. This prevents duplication of the demographic data in tables. You want to limit repetitive data entry. In place of large tables with duplicated data, you create smaller separate tables. You join them only when you need to. Queries are used to join the tables together. 4. In the window that opens, between Private Sub Form_... and End Sub, insert [Updated] = Date Updated is the field name that will be updated. 3. At the top of the Property Sheet be sure Form is selected. Next to Before Update, on the Event tab select Event Procedure. Click on the ellipses.... Normalization Normalization is the process of achieving the optimum design in a database. This makes the database easy to manipulate and search, as well as helping to insure data integrity. The three most common steps of normalization are First Normal Form, Second Normal Form and Third Normal Form. First Normal Form is the most basic level of normalization. To meet the requirements of this level, each of the column (field) values must be atomic (store a single value.) If your database has a field for courses and lists two or three courses in each field it is not in first normal form. In addition, groups of columns cannot be repeated, so your table could not have visit1, visit2, etc. and be in first normal form. In MS Access 2010 there is a new multivalued field. This is a field that does hold multiple values. However, this is a special field. The MS Access database engine is not actually storing the multiple values in a single field. The values are being stored separately and MS Access is managing it in system tables that are hidden from the user. 5 Close out the Visual Basic. The field Updated will now update when the record is updated. Test out this feature by making a change to the city for the first record. (These steps will need to be repeated for any new forms that are created for an automatic update.) Save and close the form. 14 15

Relationships There are three types of relationships in Access: One-to-Many, Many-to-Many and Oneto-One. One-to-Many A one-to-many relationship is the most common type of relationship. In a one-to-many relationship, a record in Table A can have many matching records in Table B, but a record in Table B has only one matching record in Table A. In our example today each record in our Student information table refers to one student. In the Visit Information table, each record refers to one visit, but each student can have more than one visit. (Secondary table) Look up Table Continue with Student Information table in Design View. Click in the Major row and select Lookup Wizard... from the drop down box in the Data Type column. In the first dialog box of the Lookup Wizard select I want the lookup column to look up the values in a table or query. Click Next. 3. Choose Table: Major in the next dialog box. Click Next. Many-to-Many In a many-to-many relationship, a record in Table A can have many matching records in Table B, and a record in Table B can have many matching records in Table A. This type of relationship is only possible by defining a third table (called a junction table) whose primary key consists of two fields - the primary key from both Tables A and B. A many-to-many relationship is really two one-to-many relationships with a third table. 4. 5. In the next dialog box select all fields. Click Next. In the following dialog box select Major Abbreviation for What sort order do you want for your list? Click Next. In the next dialog box of the Lookup Wizard leave the Hide key column checked. Click Next. One-to-One In a one-to-one relationship, each record in Table A can have only one matching record in Table B, and each record in Table B can have only one matching record in Table A. This type of relationship is rarely used, because most information related in this way would be in one table. You might use a one-to-one relationship to divide a table with many fields, to isolate part of a table for security reasons, or to store information that applies only to a subset of the main table, for example, a second address. 6. Leave the title Major in the text box for What label would you like for your look-up column? Click Finish. 7. Click Yes when the next dialog box asks The table must be saved before relationships can be created. Save now? Assign majors to your students in datasheet view. Close the table. 16 17

Relationships can be created in queries or at the table level. Unless you do not want your relationships to always exist, you should create your relationships at the table level. You can use the Relationship Builder to do this. Select the Database Tools tab. Click the Relationships icon to open the relationship window. You will see the Lookup relationship that we just created. 5. To create the relationship between the primary key NetID in the Student Information table (the primary table) and the foreign key, NetID, in the Visit Information table (related or secondary table), click on NetID in the Student Information table and drag it to NetId in the Visit Information table. The two fields did not have to have the same name, but they do need to be the same type. Click the Show Table icon under the Relationship Tools Design tab so that we may add the Visit Information table to the Relationships window. 3. Click on Visit Information followed by the Add button to add the Visit Information table to the Relationships window. The three tables shown below should be in the Relationships window. Click on the Close button in the Show Table window. 6. The Edit Relationships dialog box opens. This is a one-to-many relationship. There is only one NetID and record for each student in the Student Information table, while in the Visit Information table there are many NetID s and records referring to the same student. After the relationship is set up, queries can be created that draw from both tables. Check Enforce Referential Integrity. The user will be prevented from entering a record in the Visit Information table if there is not a matching NetID record in the Student Information table. Referential Integrity is enforced based on the key fields. When Enforce Referential Integrity is checked, Microsoft Access won t let you create orphans in your secondary table. 4. Next we want to create the relationship for each single record in the Student Information table that links to multiple records in the Visit Information table. We will set up a one-tomany relationship. Each student in the Student Information table can have many visits in the Visit Information table. To link tables, the primary field from one table is linked to a foreign key field in the secondary table. Select Cascade Update Related Fields. By doing this changes in the primary key in the Student Information table will automatically be transferred to the Visit Information table. Click on the Join Type button. 18 19

7. Your choice here will influence query results. Click on the third and most popular choice. This will include all records from the Visit Information table and only related records from the Student Information table. Click OK. Enforce Referential Integrity Try entering a record with the NetID abc1 in the Visit Information table. Access won t let you enter it because it doesn t exist in the primary table. Referential Integrity is enforced based on the key fields. When Enforce Referential Integrity is checked, Microsoft Access won t let you create orphans in your secondary table. 8. Click Create to create the relationships between the two tables. 3. Open the Student Information table and add a record with NetID abc Fill in the other fields of this record with data. Close this table. Now enter a record with NetId abc1 in Visit Information. This student can now be entered in the related or secondary table. 9. Now in the Relationships window, a new line is visible, displaying the one-to-many relationship. The one is on the Student Information, primary table side and the many is on the Visit Information, related table side. Cascade Update Related Fields Notice that jts2 appears in both primary and secondary tables. Open both tables to check this out. 10. Close the Relationships window and save changes to the layout. 20 21

Change jts2 to mmm5 in the primary Student Information table. When you move to the next record in the Student Information table the changes will automatically be transferred to the Visit Information table. Change mmm5 back to jts2 in the Student Information table. Automatically Filling in Data From One of Two Joined Tables (Based on the One-to-Many Relationship) If a query brings in data from two or more tables, some of the fields can be automatically filled in. When setting up the query, select the foreign key of the linked field rather than the primary key. The fields from the Primary table will be automatically filled in. A form can be based on this query and the fields will be automatically filled in also. Select the Create tab. Click on the Query Design icon in the Other section. From the Show Table dialog box add the tables Visit Information and Student Information to the Query window. Close the Show Table dialog box. Open the query and field windows so you can see all the fields. 3. Close the two tables. From the Visit Information table add NetId, the foreign key with the many symbol next to it. From the Student Information table add First_name, Last_name, Major and City. Return to the Visit Information table and add VisitId, Date, Time and Diagnosis. Visit Information NetId Student Information First_name Last_name Major City Visit Information VisitID Date Time Diagnosis 22 23

3. Run the query by clicking on the Run icon located on the Query Tools Design tab. 4. Add new information to the query window, Datasheet View, using an existing NetId. Add the NetId jts2 and click the tab key. The information from the Student Information table is automatically filled in the Datasheet View of the query window. Add new data for the visit. The new data for visit information is automatically populated to the Visit Information table. 3. View your data by Student Information. Leave the default Form with subform(s). Click Next. A form created from this query would also automatically fill in fields from the Student Information table. The new data on the form would also be automatically entered into the Visit Information table. 5. Close the query and save it. Creating a Form with a Subform (Based on the One-to-Many Relationship) To create a form with a subform, we add the fields from the two tables we are using on the forms. Select the Create tab. Select Form Wizard. 4. Select Datasheet for the Layout of your subform. Click Next. Select Table:Student Information and move all the fields to Selected Fields. Select Table: Visit Information and move all the fields to Selected Fields. Click Next. 5. Choose a style and click Next. 24 25

6. Click Finish. Action Queries There are two types of queries in Access: Select and Action. Select queries display data and action queries alter data. The action queries are: Delete, Update, Append and Make Table. The next three queries we will look at are the Make Table, Delete and the Append queries. These three queries are often used together to provide a very useful function: removing outdated records and storing them in an archive table. This is called Archiving Records. We will follow a three-step process: first we will use a Make-Table query to create a table. Second, we will use a Delete query to remove the records we copied from the first table. Finally, we will create an Append query to copy records from our main table to our archive table in the future. Make-Table Query Our first step will be to create a Make-Table query. Select the Create tab. Select the Query Design icon. 7. Now you can view your main form with a subform on it. Notice there are two navigation bars. The navigation bar at the very bottom scrolls through the primary table. The second navigation bar is on the secondary table and shows each visit for a student. Close the forms when finished testing them. Select the Student Information table from the Show Table dialog box that pops up. Then Close that dialog box. 3. Add all of the fields to the Query grid. Double-click the title bar of Student Information. Click and drag the highlighted fields to the first column, top cell and release the mouse button. Notice that Access spreads out the fields automatically. 26 27

4. We will archive all records prior to January 1, 1999. Locate the Criteria cell of the Updated field. Type <1/1/1999 in the Criteria cell. 10. Name the query qrymakearchive in the Save As dialog box. 1 Click OK. Now we will run the query to make another table identical to our original table, but only containing records that meet the criteria specified in the Updated field of the criteria row. 1 Select the Run icon to run the query. 5. Under the Query Tools Design tabs in the Query Type section, select the Make Table icon. 13. A warning window will tell you how many records are going to be pasted. A message warns you there is no undo. (But you can always delete the new table.) Click Yes. tblarchivedrecords will appear under the Tables category. 6. 7. 8. 9. Type the name tblarchivedrecords in the Table Name: text box. This will be the name of the table with archived records. Notice that you can save the table to another database to help keep the size of this database small. Click OK. Right click on the tab title Query Select Save. 14. Open the tblarchivedrecords table and verify that there is one record. 15. Close table tblarchivedrecords. 28 29

Delete Query With the Archive table created and our initial record copied it is time to move to the second step: deleting the copied record from the original table. The Delete query will destroy information permanently, so be careful when you use it. We will not save this Delete query. We will now add a parameter to the query so that we can set the date range for the archived records: 3. Locate the Criteria cell for the Updated field. Delete the 1/1/1999. Right click in the cell, click Zoom. With the Make-Table query in Design View, select the Delete icon on the Query Tools Design tab, in the Query Type section. Run the query by clicking the Run icon in the Results section of the Query Tools Design tab. 4. Type Between [Beginning Date:] And [Ending date:] Click OK. 3. Click Yes in the warning box, You are about to delete 1 row(s) from the specified table. The record has now been deleted from table Student Information. Append Query Now we will create a query that will append records to our table in the future. Select the Append query icon on the Query Tools Design tab in the Query Type section. 5. Select the Microsoft Windows icon in the top left of the program, hover over the Save As icon and select the Save Object As icon. Leave tblarchivedrecords as the Table Name:. This is the table we will be appending records to, the archived table. Click OK. Notice that a Sort row has been added to the grid, and that an Append To: row has replaced the Delete: row. 6. Name the query qryappendstudents. Click OK. Run query qryappend Students and test it with todays date. To complete the archiving of records, you would set up a Delete query. The Delete query would be run each time after running qryappendstudents to delete those students who were just archived. Close any open tables or queries. 30 31

Basic Forms Select the Create tab. In the Forms section select More Forms. From the drop-down gallery select Form Wizard. Advanced Forms We will add controls to our form. Up until now we have used forms to enter data into tables. Controls increase the usability of forms. Using the Command button you can add record navigation, record operations, form operations and report operations to your forms. On the Home tab, select the drop-down arrow under the View icon and select Design View. Stretch the grid in the Detail section to give yourself extra space to place the controls. Select Student Information in the Tables/ Queries text box. Click >> to select all of the fields and click Next. 3. Select Columnar and click Next. The Use Control Wizards icon should be highlighted. In the Controls section of the Form Design Tools Design tab select the Button icon. Your cursur will turn into a rectangle with a plus sign when you move it over the grid. 4. Select Access 2010 (or another style if you prefer) and click Next. Change the name of the form to frmstudentinformation. Click Finish. 3. Click and drag in the Detail section of your form to make a small rectangle. The Command Button Wizard will open. Record Navigation - Go to Next Record 5. Enter the following record using the form (try to enter data incorrectly and you will notice that our masks and validation rules still apply): 4. Select Record Navigation in Categories. Select Go to Next Record in Actions. Click Next. 32 33

5. Click the Picture radio button. Select one of the pictures by selecting its descriptive text. Click Next. A switchboard is a special type of form. Switchboards can be set up so persons who are unfamiliar with Microsoft Access can still use your database. On a switchboard, buttons are placed on a blank form. The buttons give the user instant access to tables, forms, queries and reports. Switchboards can also be created using the Switchboard Manager. We will need to add a custom command to the ribbon. Right click on the Ribbon and choose Customize Ribbon. In the Choose commands from drop down list, select Commands not In the Ribbon. In the Main Tabs area, add a New Group to Database Tools tab. Select Switchboard Manager and click Add and then click Ok. 6. Name the button cmdnext. Click Finish. Select the Database Tools tab. In the Database Tools section select the Switchboard Manager icon. Record Navigation - Go to Previous Record 7. Perform the same steps to add a Previous button to your form. Name it cmdprevious. When the following message appears, click the Yes button. Record Navigation - Find Record 8. Again, click the Command button icon and draw another rectangle on your form. 9. Select Record Navigation in Categories and Find Record in Actions. Click Next. 10. Click the text radio button and type Search in the text box. Click Next. 1 Name the button cmdsearch and click Finish. 3. In the Switchboard Manager dialog box, click on Edit. 1 Switch to Form View and test the buttons. When testing the search button first click in a field and then click Search. Notice that the button allows you to search in whichever text box on your form has focus. Close and save changes to your form. 34 35

4. In the Edit Switchboard Page dialog box, change the Switchboard Name to Student Advising. Click the New button. Macros Computers are great at repetitive tasks. In Microsoft Access a macro can be set to run repetitive tasks. One macro can run a series of commands. Once the macro is set up, it can also be assigned to a button on a form. Macros can be used to open a form in edit mode, add mode or read only mode. You can use a macro to open or print a report. A macro can be used to launch the main switchboard form. We will show you a simple macro that opens an hourglass, form and a table and ends with a beep. 5. In the Edit Switchboard Item dialog box, fill in and select options as shown. Click OK. Select the Create tab. In the Other section, select the Macro icon. 6. Once more click on New in the Edit Switchboard Page and Add a command to Exit Microsoft Access. Change the text in the Text: box. Click OK. Close the Edit Switchboard Page and Close the Switchboard Manager. Click on the drop-down arrow in the Action column. Choose DisplayHourglassPointer. 7. Test out your new Switchboard by clicking on the Form titled Switchboard in the Navigation pane. Note: To have your switchboard open automatically when opening this database, select the Office button, Access Options. Select Current Database in the left hand pane. Below Application Options, locate Display Form and select your switchboard form. 3. In the next row of the Action column select OpenForm. Next to Form Name in the lower half of the Macro dialog box under ActionArguments choose frmstudentinformation. 36 37

4. In the next row of the Action column select Open Table. Select Student Information for the Table Name under Action Arguments. 5. For the next Action choose Beep. 6. Close the Macro window and select Yes when asked if you want to save changes to the design of macro Macro1? Name the macro Beep. Test out the macro by running it. Note: If a macro is named AutoExec, it will be the first element run when the database is opened. 7. Close the form and table. Close your database. Microsoft Access 2010 Limits 255 - The maximum number of fields allowed in a table. 2 gigabytes - File size of Microsoft Access database, including all objects (*.accdb or *.mdb). 32,768 - Objects allowed in a database, which includes tables, forms, reports, queries, macros, modules, indices and internal objects. 64 - Number of characters allowed in a table name or a field name. 38 39

A publication of ITS User Services, a division of Information Technology Services, Mississippi State University Mississippi State University does not discriminate on the basis of race, color, religion, national origin, sex, age, disability, or veteran status.