Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Concurrency control wikipedia , lookup
Open Database Connectivity wikipedia , lookup
Ingres (database) wikipedia , lookup
Functional Database Model wikipedia , lookup
Entity–attribute–value model wikipedia , lookup
Microsoft Access wikipedia , lookup
Clusterpoint wikipedia , lookup
ContactPoint wikipedia , lookup
Microsoft Jet Database Engine wikipedia , lookup
Extensible Storage Engine wikipedia , lookup
A Guide to the use of: Access 2013 Developed by: Customer Support Information Technology School District of Palm Beach County i Version 1 Access Table of Contents 1 2 INTRODUCTION ................................................................................................ 1-1 1.1 TERMS..................................................................................................................................... 1-1 1.2 RELATIONAL DATABASE MANAGEMENT SYSTEM ........................................................................ 1-3 1.3 FUNDAMENTALS ....................................................................................................................... 1-4 GETTING STARTED .......................................................................................... 2-1 2.1 OPENING ACCESS .................................................................................................................... 2-1 2.2 DATABASE TEMPLATES ........................................................................................................... 2-2 2.3 NEW DATABASE ....................................................................................................................... 2-2 2.4 CLOSING A DATABASE AND EXITING ACCESS ............................................................................. 2-3 2.5 OPENING AN EXISTING DATABASE ............................................................................................. 2-4 2.6 DATABASE W INDOW ................................................................................................................. 2-4 2.6.1 2.6.2 Quick Access Toolbar ........................................................................................................ 2-5 Ribbon and Tabs ............................................................................................................... 2-5 2.6.2.1 Ribbon ........................................................................................................................................................ 2-5 2.6.2.2 Tabs ............................................................................................................................................................ 2-6 2.6.2.2.1 File Tab ............................................................................................................................................ 2-6 2.6.2.2.1.1 Info ............................................................................................................................................. 2-6 2.6.2.2.1.2 Account ..................................................................................................................................... 2-7 2.6.2.2.1.3 Print ........................................................................................................................................... 2-7 2.6.2.2.1.4 Options ....................................................................................................................................... 2-7 2.6.2.2.2 Home Tab ......................................................................................................................................... 2-7 2.6.2.2.3 Create Tab ........................................................................................................................................ 2-8 2.6.2.2.4 External Data Tab ............................................................................................................................ 2-8 2.6.2.2.5 Database Tools Tab .......................................................................................................................... 2-8 2.6.3 Navigation Pane ................................................................................................................ 2-8 2.6.3.1 Hide/Display ............................................................................................................................................... 2-8 2.6.3.2 Organize ..................................................................................................................................................... 2-8 2.6.3.3 Objects ........................................................................................................................................................ 2-9 2.6.3.3.1 Viewing ............................................................................................................................................ 2-9 2.6.3.3.2 Sorting .............................................................................................................................................. 2-9 2.6.3.3.3 Search ............................................................................................................................................... 2-9 3 TABLES ............................................................................................................. 3-1 3.1 CREATE A NEW TABLE .............................................................................................................. 3-1 3.2 DESIGN VIEW ........................................................................................................................... 3-2 3.2.1 Table Design...................................................................................................................... 3-3 3.2.1.1 3.2.1.2 3.2.1.3 3.2.1.4 3.2.2 3.2.3 3.2.4 4 Field Name ................................................................................................................................................. 3-3 Data Type ................................................................................................................................................... 3-3 Description ................................................................................................................................................. 3-4 Field Properties ........................................................................................................................................... 3-4 Data Entry .......................................................................................................................... 3-6 Primary Key ....................................................................................................................... 3-6 Multiple Primary Keys ........................................................................................................ 3-6 DATASHEET RECORDS ................................................................................... 4-1 i Version 1 Access 4.1 ADDING RECORDS .................................................................................................................... 4-1 4.2 EDITING RECORDS ................................................................................................................... 4-1 4.3 DELETING RECORDS................................................................................................................ 4-1 4.4 ADDING AND DELETING COLUMNS ............................................................................................. 4-2 4.5 RESIZING ROWS AND COLUMNS ................................................................................................ 4-2 4.6 FREEZING COLUMNS ................................................................................................................ 4-3 4.7 HIDE/UNHIDE COLUMNS ........................................................................................................... 4-3 4.8 FINDING DATA IN A TABLE ......................................................................................................... 4-3 4.9 REPLACE ................................................................................................................................. 4-4 4.10 CHECK SPELLING ..................................................................................................................... 4-4 5 TABLE RELATIONSHIPS .................................................................................. 5-1 6 SORTING AND FILTERING ............................................................................... 6-1 7 8 6.1 SORTING.................................................................................................................................. 6-1 6.2 FILTER BY SELECTION .............................................................................................................. 6-1 6.3 FILTER BY FORM...................................................................................................................... 6-2 6.4 SAVING A FILTER ...................................................................................................................... 6-2 6.5 REMOVE A FILTER .................................................................................................................... 6-2 QUERIES ........................................................................................................... 7-1 7.1 CREATE A QUERY..................................................................................................................... 7-1 7.2 SIMPLE QUERY W IZARD............................................................................................................ 7-2 7.3 FIND DUPLICATES QUERY ......................................................................................................... 7-3 7.4 DELETE A QUERY ..................................................................................................................... 7-4 FORMS ............................................................................................................... 8-1 8.1.1 8.1.2 8.2 8.2.1 8.2.2 8.3 8.3.1 8.3.2 8.4 8.4.1 8.4.2 8.4.3 8.4.4 8.4.5 8.5 9 Create Form....................................................................................................................... 8-1 Adding Records Using a Form .......................................................................................... 8-2 LAYOUT VIEW........................................................................................................................... 8-2 Resize columns ................................................................................................................. 8-2 Remove Stacking .............................................................................................................. 8-3 DESIGN VIEW ........................................................................................................................... 8-4 Create a Form.................................................................................................................... 8-4 Editing Forms..................................................................................................................... 8-5 FORMS CONTROL ..................................................................................................................... 8-6 List and Combo Boxes ...................................................................................................... 8-6 Check Boxes and Option Buttons ..................................................................................... 8-8 Command Buttons ............................................................................................................. 8-9 Conditional Formatting ...................................................................................................... 8-9 Password Text Fields ...................................................................................................... 8-10 SPLIT FORM ........................................................................................................................... 8-10 REPORTS .......................................................................................................... 9-1 9.1 REPORT................................................................................................................................... 9-1 9.2 REPORT W IZARD ...................................................................................................................... 9-2 ii Version 1 Access 9.3 REPORT DESIGN VIEW ............................................................................................................. 9-4 9.4 PRINTING REPORTS ................................................................................................................. 9-4 10 EXTERNAL DATA ........................................................................................ 10-1 10.1 IMPORTING............................................................................................................................. 10-1 10.2 EXPORTING ............................................................................................................................ 10-3 iii Version 1 Access Updates Version 1 Baseline release version iv Version 1 Access This page is blank i Version 1 Access 1 Introduction Of all the programs in the Microsoft Office suite, Microsoft Access is the one that most intimidates people. "Mastering Microsoft Excel or Word was hard enough," they think. "How can I ever understand a complicated program like Access?" While it's true that Microsoft Access has many advanced features (there are computer consultants whose only job is programming Access databases), creating and working with a Microsoft Access database is probably a whole lot easier than thought. 1.1 Terms Many words or terms are used as a basis for the use of Access. They are included here to increase familiarity with them prior to using the program or this guide. A field is a group of related characters and defines a data type for a set of values in a table. Fields could be setup for groups of numbers and/or letters that form things such as first name, last name, address, city, state, zip code, or telephone number. A record is a group of related fields that form a row in a table. In a mailing list table, each record would contain the data for one person as specified by the intersecting fields. A table is a grouping of related data organized in fields (columns) and records (rows). By using a common field in two tables (keys), the data can be combined. Many tables can be stored in a single database. A database must always contain at least one table where it can store information all the other are optional. A database is a collection of related information that is organized into a list and stored in a manner similar to a file cabinet. Whenever a person makes a list of information, such as names, addresses, products, or invoices, they are, in fact, creating a database. Technically speaking, it is not necessary to use a database program to create a database. In the simplest sense, a database is a collection of records and files that are organized for a particular purpose. 1-1 Version 1 Access Database objects are the basic components that make up a database. Database objects include tables, queries, forms, reports, pages, macros. o Table. An object that you define and use to store data. Each table contains information about a particular subject, such as customers or orders. Tables contain fields (or columns) that store different kinds of data, such as a name or an address, and records (or rows) that collect all the information about a particular instance of the subject, such as all the information about a department named Housing Administration. You can define a primary key (one or more fields that have a unique value for each record) and one or more indexes on each table to help retrieve your data more quickly. o Query. An object that provides a custom view of data from one or more tables. In Access, you can use the graphical query by example (QBE) facility or you can write Structured Query Language (SQL) statements to create your queries. You can define queries to select, update, insert, or delete data. You can also define queries that create new tables from data in one or more existing tables. o Form. An object in a desktop database designed primarily for data input or display or for control of application execution. You use forms to customize the presentation of data that your application extracts from queries or tables. You can also print forms. You can design a form to run a macro or a Microsoft Visual Basic procedure in response to any of a number of events—for example, to run a procedure when the value of data changes. o View. An object in a web app designed primarily for data input or display or for control of application execution. You use views to customize the presentation of data that your app extracts from queries or tables. Users interact with views inside a web browser. You can design a view to run macros and data macros in response to any of a number of events—for example, to run when the value of data changes. o Report. An object in desktop databases designed for formatting, calculating, printing, and summarizing selected data. You can view a report on your screen before you print it. o Macro. An object that is a structured definition of one or more actions that you want Access to perform in response to a defined event. For example, you might design a macro that opens a second form in response to the selection of an item on a main form. You can include simple conditions in 1-2 Version 1 Access macros to specify when one or more actions in the macro should be performed or skipped. You can use macros to open and execute queries, to open tables, or to print or view reports. You can also run other macros or Visual Basic procedures from within a macro. o Data Macro. An object that is a structured definition of one or more actions that you want Access to perform on data stored in tables. Data macros can be attached directly to table events such as inserting new records, editing existing records, or deleting records. Data macros in web apps can also be stand-alone objects that can be called from other data macros or macro objects. o Module. An object in desktop databases containing custom procedures that you code using Visual Basic. Modules provide a more discrete flow of actions and allow you to trap errors. Modules can be stand-alone objects containing functions that can be called from anywhere in your application, or they can be directly associated with a form or a report to respond to events on the associated form or report Design View provides the tools for creating fields in a table. Datasheet View allows you to update, edit, and delete information from a table. 1.2 Relational Database Management System Nearly all modern database management systems store and handle information using the relational database management model. In a relational database management system, sometimes called an RDBMS, the system manages all data in tables. Tables store information about a single subject (such as customers or products) and have columns (or fields) that contain the different kinds of information about the subject (for example, customers’ addresses or phone numbers) and rows (or records) that describe all the attributes of a single instance of the subject (for example, data about a specific customer or product). Even when you query the database (fetch information from one or more tables), the result is always something that looks like another table. 1-3 Version 1 Access The term relational stems from the fact that each table in the database contains information related to a single subject and only that subject. If you study the relational database management model, you’ll find the term relation applied to a set of rows (a table) about a single subject. Also, you can manipulate data about two classes of information (such as customers and orders) as a single entity based on related data values. For example, it would be redundant to store customer name and address information with every order that the customer places. In an RDBMS, the information about orders contains a field that stores data, such as a customer number, which can be used to connect each order with the appropriate customer information. 1.3 Fundamentals A database program, however, is much more powerful than a simple list kept on paper or in a Microsoft Word document. A database program permits: Store Information: A database stores lists of information that are related to a particular subject or purpose. It could be a list of home inventory, or business information, such as a list of hundreds of thousands of customers. A database also makes it easy to add, update, organize, and delete information. Find Information: Easily and instantly locate information stored in a database. For example, find all the customers with the last name "Johnson" or all the customers who live in the 33417 zip code and are older than 65. Analyze and Print Information: Perform calculations on information in a database. For example, calculate what percent of the total sales comes from the state of Texas. Can also present information in a professional-looking printed report. Manage Information: Databases make it easy to work with and manage huge amounts of information. For example, with a few keystrokes you can change the area code for hundreds of customers in the (312) area code to a new (605) area code. Share Information: Most database programs (including Microsoft Access) allow more than one user to view and work with the same information at once. Such databases are called shared databases. 1-4 Version 1 Access 2 Getting Started Microsoft Office Access enables users to quickly create relational databases. Access puts the control in the user’s hands to create tables, queries, forms and reports. The 2013 version of Microsoft Access gives the user the ability to use web apps. A web app is an Access application that is hosted on a SharePoint 2013 server running Access Services. While available and now an integral part of Microsoft Access, the use of web apps will not be included. This document and training will concentrate on the use of a desktop database 2.1 Opening Access To open Access on your computer: Select Start Select All Programs Select Microsoft Office Select Microsoft Office Access 2013 If there is an icon of Microsoft Access available on your desktop (shaped like a square with a red chart), you can open up the program by double-clicking it, as well. 2-1 Version 1 Access 2.2 Database Templates New Database On the Office Start screen tab of the Backstage view, you can access the built-in local desktop templates by clicking one of the template icons in the center of the screen. You can identify whether a template on the Office Start screen is a desktop database by looking for the text Desktop in the template name. 2.3 New Database When you click one of the desktop template graphics on the Office Start screen, Access displays additional detailed information about the purpose of the template in a pop-up dialog. Click the Desktop Task Management template in the middle of the screen to see detailed information about the template Name the new database in the File Name text box and a location to save the file beneath the File Name text box. You can modify the name of this database by typing in the File Name text box. If you want to change the suggested save location, click Browse to open the File New Database dialog box. 2-2 Version 1 Access The location of the saved database can be changed by clicking on the small folder to the right of the File Name block. A File New Database menu screen opens This menu can be used to select the drive in which the database is to be saved as well as the name of the file. Enter the appropriate information and click on the OK button. The system returns to the Getting Started with Microsoft Access screen. Click on the Create button. 2.4 Closing a Database and Exiting Access Click the Database window's Close button. If any of the Access windows are maximized, two Close buttons will be on the screen. Make sure the lower Close button is clicked to close the database window. (The Close button located in the far, upper right-hand corner of the screen closes the Microsoft Access program.) The current database closes, but the Access program does not. Click the Database window's Close button. Whenever the Database window is closed, closed. 2-3 the current database is Version 1 Access 2.5 Opening an Existing Database If the database was opened recently on the computer, it will be listed on the Recent section of the Access pane. Click the database name. Otherwise Click on Open Other Files. Click on Computer Search file computer file structure for the desired database. 2.6 Database Window The Database Window organizes all of the objects in the database. The default tables listing provide links for creating tables and will list all of the tables in the database when they have been added. For new databases, Access, by default, creates a new table in Datasheet view called Table1 with an ID field already defined. However, Access has not saved this table, so if you do not make any changes to it, Access will not prompt you to save the table if you close it. 2-4 Version 1 2.6.1 Access Quick Access Toolbar In the upper left corner of the window, there is an area called the Quick Access Toolbar. This area contains several of the most used buttons in Office applications – Save, Undo, Redo, Print and Print Preview. This toolbar can be customized by adding and removing as many Quick Access button choices as needed. To customize the Quick Access Toolbar, Click on the small arrow to the right of the bar. If the ability to draw a table were to be added to the toolbar; o Click the Draw Table Entry o A check mark will be added to the left of the Draw Table entry and the Draw Table icon will be added to the Quick Access Toolbar. To remove buttons from the Quick Access Toolbar: o RIGHT click on the button to be removed o 2.6.2 Choose Remove Access Toolbar. from Quick Ribbon and Tabs 2.6.2.1 Ribbon The ribbon is the most visual change from the previous version of Microsoft Office. Each Ribbon has a series of Tabs and Groups that provide details and options that are available within that tab or category, Tabs Groups 2-5 Version 1 Access 2.6.2.2 Tabs The Tabs are, logically, a bit different for each 2013 Office application to assist with the most common features of that application. All the 2013 Office applications begin with the Home tab. The Tabs to the right of the File are tailored to each application. The Tabs for Access are: File tab provides access that brings up a full screen of commands and information. Home tab contains the basic operations such as cut/copy/paste, font & paragraph formatting, themes and styles. Create tab permits the user access templates, tables, forms, reports macros and codes. External Data tab permits the user to import and export data from other file formats. Database Tools tab to manage data, relationships and macros. 2.6.2.2.1 File Tab The File tab brings up a full screen of commands and information. This screen is part of the Backstage environment. It identifies and contains all of the supporting features needed for the database. The Backstage View provides access to the normal File functions such as Save, Save As, Open, etc. as well as several options 2.6.2.2.1.1 Info The Info portion of the Backstage contains information about permissions, versions, and properties of the file. The name of the file is listed at the top of the window, and a detailed list of the file properties can be displayed 2-6 Version 1 Access 2.6.2.2.1.2 Account The Account option displays information related to the user and MS Office. It identifies the version of the software as well as any background or theme information. 2.6.2.2.1.3 Print The Print option displays the printer options along with a print preview of how the page will appear when printed. Selecting Print opens the printer window for the selection of the printer and other print data. 2.6.2.2.1.4 Options The Options screen provides access the settings that are used within MS Office. Many of these options are unique to the application (Word, Excel, etc.) that is currently being accessed. Most apply to all of MS Office applications. Note: Caution should be taken when changing any of the system options. 2.6.2.2.2 Home Tab This tab contains many of the most commonly used features. Popular commands include: Views Clipboard (Cut/Copy/Paste) Sort & Filter Records Find Text Formatting 2-7 Version 1 2.6.2.2.3 Access Create Tab The create tab provides options for the creation of tables, queries, forms reports & macros. It permits the user to develop each from a design mode or from the use of a wizard that creates preset formats. 2.6.2.2.4 External Data Tab As the title suggests, this tab contains groups and commands related to importing , linking and exporting data from multiple sources. 2.6.2.2.5 Database Tools Tab The database tools tab permits the user to establish relationships between table and to move data to SharePoint or an SQL server 2.6.3 Navigation Pane The Navigation pane is on the left side of the screen. It displays the database objects, e.g. Tables, queries, reports. By default, the objects are placed in categories and then each category is split into groups. 2.6.3.1Hide/Display To hide/display the Navigation pane, click the Shutter Bar Open/Close button. If the pane is not displayed, press the F11 key. 2.6.3.2 Organize The user can organize how the objects are displayed in the Navigation pane. Object Type and e.g. Table. Only displays the selected object type, e.g. Tables, Queries, and Forms. Tables and Related Views. database. Created/Modified Date and Show All. Displays all of the objects in date order depending on the view and sort options. Object Type and Show All. The most common settings. Displays all of the objects and expand/close each of the groups. Groups objects related to each table in the 2-8 Version 1 Access 2.6.3.3 Objects Additional tools are available to assist with viewing, finding and sorting objects. To activate these tools, right click in the title area of the Navigation pane. 2.6.3.3.1 Viewing The database objects can be viewed by Detail, Icon or List. Right click the white space of the Navigation pane. Select View By. Choose the option required. 2.6.3.3.2 Sorting The database objects can be sorted by Name, Type, Date, etc. Right click the white space of the Navigation pane. Select Sort By. Chose the option required. 2.6.3.3.3 Search A quick way to find an object is to use the Search Bar. Right click the white space of the Navigation pane. Select Search Bar. Enter the information. 2-9 Version 1 Access 3 Tables Tables are grids that store information in a database similar to the way an Excel worksheet stores information in a workbook. Creating tables in design view gives you the greatest control over how the fields and properties are set, but it also involves more work than other techniques. 3.1 Create a New Table When the steps are taken to create a new database, Access begins with the concept of creating the primary component of a database. That is, a table. Access opens a table format and the Ta4ble Tools and Design tabs. The table displays a title of Table1. This will be revised when the new table is saved. On the left side of the Table Tools- Datasheet tab is the Views group. The options are Datasheet View and Design View. The icon in the group toggles between the two View icons depending upon which one is currently accessed. A new table is to be created, so the Design View icon is selected. The Save As menu screen appears to permit the user to name the new table. When the name is entered and the OK button is clicked, 3-1 Version 1 Access 3.2 Design View The Design View affords the user the ability to create a new table or to modify existing tables. The sample shown is for the creation of a new table. A portion of the image was enlarged to improve readability. The Table Tools tab is still highlighted, but a new Design tab is open. This tab contains the groups needed to design a table. Within the Tools group, the first command is for Primary Key. This entry can be turned off by clicking on the Primary Key icon. The use of the key will be included in a later section. 3-2 Version 1 Access The tab is open for the new table and contains position for entry of a Field Name, Data Type and Description. The lower half of the screen displays the Field Properties. 3.2.1 Table Design When creating a database it is always best to “break down” a field into its “smallest parts.” For example – Name would break down into First Name, and Last Name. Address would break down into Street Address, City, State, and Zip. Also, numeric fields should have a Data Type of text unless they are actually used for calculations, e.g. Employee Number, Social Security Number, and Phone Number. 3.2.1.1 Field Name The first entry was Employee Number. When Enter is tapped, the cursor moves to the Data Type field. Click the down arrow to display the available data types. 3.2.1.2 Data Type Short Text. This entry can be any alphabetical/numerical data up to a maximum of 255 characters. As indicated, this is a text field, so it can't do mathematical calculations. Examples of text data are: names, addresses, stock numbers, room numbers, zip codes, etc. In earlier versions of Access, this data type was called Text. Long Text . Large amounts of text, up to 65,536 characters. In earlier versions of Access, this data type was called Memo. Because it is freeform, it cannot be used to sort. 3-3 Version 1 Access Number. This entry is for numbers to add, subtract, multiply, divide, average, and do numerical calculations. Field Size property provides for Byte, Integer, Long Integer (default), Single, Double, Replication ID, Decimal. Date/Time. Dates and Times. Currency. AutoNumber. This entry is an "automatic" counter that assigns a number each time data is put into a new field. Yes/No. This is a "True/False" or "Yes/No" type of entry. OLE Object. This means "Object Link Embedding" which indicates the user cn insert a graphic, picture, sound, etc. Calculated. Calculated Field. Dollars ($). . Hyperlinks, Attachments, or Lookup Wizards will not be discussed in this guide. 3.2.1.3 Description Provides space for remarks that may be appropriate for others to know the how or why for designing the field. This entry appears at the bottom of the screen when Access is in the Datasheet View. 3.2.1.4 Field Properties Click-in each area to the right of the words. Field Size. Currently set to 255 characters. Click-in this area and change the number to a value somewhat larger than expected. It can always be adjusted later. Format. Format conforms the data in the field to the same format when it is entered into the datasheet. For text and memo fields, this property has two parts that are separated by a semicolon. The first part of the property is used to apply to the field and the second applies to empty fields. Indexed fields allow Access to query and sort records faster. To set an indexed field, select a field that is commonly searched and change the Indexed property to Yes (Duplicates OK) if multiple entries of the same data value are allowed or Yes (No Duplicates) to prevent duplicates. 3-4 Version 1 Access Input Mask. An input mask controls the value of a record and sets it in a specific format. They are similar to the Format property, but instead display the format on the datasheet before the data is entered. For example, a telephone number field can formatted with an input mask to accept ten digits that are automatically formatted as "(555) 123-4567". The blank field would look like (___) ___-____. Caption. Look at the Light Blue Help area to the right. It explains about Caption. Default Value. We'll come back to this feature later. Validation Rule. Validation Rules specify requirements (change word) for the data entered in the worksheet. A customized message can be displayed to the user when data that violates the rule setting is entered. Click the expression builder ("...") button at the end of the Validation Rule box to write the validation rule. Examples of field validation rules include <> 0 to not allow zero values in the record, and ??? to only allow data strings three characters in length. Validation Text. Use the ValidationText property to specify a message to be displayed to the user when data is entered that violates a ValidationRule setting for a record, field, or control. Read/write String. Required. Look at the Light Blue Help area to the right. Allow Zero Length. Look at the Light Blue Help area to the right. Indexed. Look at the Light Blue Help area to the right. Unicode Compression. Look at the Light Blue Help area to the right. IME Mode. Look at the Light Blue Help area to the right. IME Sentence Mode. Look at the Light Blue Help area to the right. Smart Tags. Look at the Light Blue Help area to the right. 3-5 Version 1 3.2.2 Access Data Entry When the design of the table is completed, the next step is to actually enter the information for each record. Each time the Design View is being exited and the Datasheet View is opened, a popup window will appears stating that the table must be saved. 3.2.3 Primary Key Every record in a table can have a primary key that differentiates it from every other record in the table. In some cases, it is only necessary to designate an existing field as the primary key if every record in the table will have a different value for that particular field. Social security numbers, employee IDs or student IDs are examples of a record whose values will only appear once in a database table. Designate the primary key field by right-clicking on the record and selecting Primary Key from the Table Tools – Design tab. The primary key field will be noted with a key image to the left. To remove a primary key, repeat one of these steps. If none of the existing fields in the table will produce unique values for every record, a separate field can be added. Access will prompt to create this type of field at the beginning of the table the first time the table is saved and a primary key field has not been assigned. The field is named "ID" and the data type is "autonumber". Since this extra field serves no purpose, the autonumber type automatically updates whenever a record is added so there is no extra work on the user’s part. This column can also be hidden. 3.2.4 Multiple Primary Keys To select multiple fields for the composite primary key, move the mouse over the gray column next to the field names and note that it becomes an arrow. Click the mouse, hold it down, and drag it over all fields that should be primary keys and release the button. With the multiple fields highlighted, click the primary key button. 3-6 Version 1 Access 4 Datasheet Records 4.1 Adding Records Add new records to the table in datasheet view by typing in the record beside the asterisk (*) that marks the new record. The new record button at the bottom of the datasheet can be clicked to skip to the last empty record. The view now changes to the Datasheet View. This view is can be used to enter the data and records required for this table. 4.2 Editing Records To edit records, simply place the cursor in the record that is to be edited and make the necessary changes. Use the arrow keys to move through the record grid. The previous, next, first, and last record buttons at the bottom of the datasheet are helpful in maneuvering through the datasheet. 4.3 Deleting Records Delete a record on a datasheet by placing the cursor in the field at the start of the record row and right clicking. Select Delete record from the menu. The ability to delete a record is dependent upon the relationships that have been established for the table.. 4-1 Version 1 Access 4.4 Adding and Deleting Columns Although it is best to add new fields (displayed as columns in the datasheet) in design view because more options are available, they can also be quickly added in datasheet view. Highlight the column that the new column should appear to the left of by clicking its label at the top of the datasheet and right click. The options window opens that contains Insert Column. 4.5 Resizing Rows and Columns The height of rows on a datasheet can be changed by dragging the gray sizing line between row labels up and down with the mouse. By changing the height on one row, the height of all rows in the datasheet will be changed to the new value. Column width can be changed in a similar way by dragging the sizing line between columns. Double click on the line to have the column automatically fit to the longest value of the column. Unlike rows, columns on a datasheet can be different widths. More exact values can be assigned by right clicking the row or column and selecting Row Height or Column Width from the menu. 4-2 Version 1 Access 4.6 Freezing Columns Similar to freezing panes in Excel, columns on an Access table can be frozen. This is helpful if the datasheet has many columns and relevant data would otherwise not appear on the screen at the same time. Freeze a column by placing the cursor in any record in the column and select Freeze Columns from the drop down menu. Select the same option to unfreeze a single column or select Unfreeze All Columns. 4.7 Hide/Unhide Columns Columns can also be hidden from view on the datasheet although they will not be deleted from the database. To hide a column, place the cursor in any record in the column or highlight multiple adjacent columns by clicking and dragging the mouse along the column headers, and select Hide Columns from the drop down menu. To show columns that have been hidden, select Unhide Columns from the drop down menu. A window displaying all of the fields in the table will be listed with check boxes beside each field name that are currently displayed. Check the boxes beside all fields that should be visible on the data table and click the Close button. 4.8 Finding Data in a Table Data in a datasheet can be quickly located by using the Find command. Open the table in datasheet view. Place the cursor in any record in the field (column) to be searched and select Find... from the Home tab, Find group. Enter the value criteria in the Find What: box. From the Look In: drop-down menu, define the area of the search by selecting the entire table or just the field in the table where the cursor was placed. Select the matching criteria from Match: to and click the More >> button for additional search parameters. 4-3 Version 1 Access When all of the search criteria is set, click the Find Next button. If more than one record meets the criteria, keep clicking Find Next the correct record is found. 4.9 Replace The replace function allows quick replacement of a single occurrence of data with a new value or to replace all occurrences in the entire table. Select Replace... from the Home tab, Find group or click the Replace tab if the Find window is already open). Follow the steps described in the Find procedure for searching for the data that should be replaced and type the new value of the data in the Replace With: box. Click the Find Next button to step through occurrences of the data in the table and click the Replace button to make single replacements. Click Replace All to change all occurrences of the data in one step. 4.10 Check Spelling The spell checker can be used to flag spelling errors in text and menu fields in a datasheet. Select Spelling from the Home Tab, Records Group to activate the spell checker and make corrections just as you would when using Word or Excel. Print a Datasheet Datasheets can be printed by using the Quick Print button on the Quick Access toolbar or by selecting Print from the Office Button, Print activity to set more printing options. 4-4 Version 1 Access 5 Table Relationships In Access, a relationship is an association between common fields in two tables. They can be used to link information from one table to the information in another table. The most common relationships that can be established are: One-to-many. Each record in a table can be linked to multiple records in another table. One-to-one. Each record in one table can have one and only one related record in another table. Many-to-many. Multiple one-to-many relationships tied together through as another table. To establish table relationships, follow the steps below to set up a relational database: Click the Database Tools tab. In the Analyze group, Click the Relationships button. From the Show Table window (click the Show Table button on the toolbar to make it appear). Double click on the names of the tables you would like to include in the relationships. When finished adding tables, click Close. 5-1 Version 1 Access To link fields in two different tables Click and drag a field from one table to the corresponding field on the other table and release the mouse button. The Edit Relationships window will appear. Select Enforce Referential Integrity. This option give Access permission to automatically make changes to referential tables if a key record in one of the files is deleted. Check the Enforce Referential Integrity box to ensure that the relationships are valid and that the data is not accidentally deleted when data is added, edited, or deleted. Click Create to create the link. A line now connects the two fields in the Relationships window. 5-2 Version 1 Access 6 Sorting and Filtering Sorting and filtering permits viewing of records in a table in a different way either by reordering all of the records in the table or view only those records in a table that meets certain criteria specified. 6.1 Sorting It may be necessary to view the records in a table in a different order than they appear such as sorting by a date or in alphabetical order, for example. Sorting in Access differs from sorting in Excel. When a column is selected in Access, the sort will sort the entire table based on that column. In Excel, the same sort procedure would only sort that single column. Follow these steps to execute a simple sort of records in a table based on the values of one field: In Datasheet View, place the cursor in the column that you want to sort by. From the Home Tab, Sort & Filter Group, select A-Z Ascending or Z-A Descending icon. To sort by more than one column (such as sorting by date and then sorting records with the same date alphabetically), highlight the columns by clicking and dragging the mouse over the field labels and select one of the sort methods stated above. 6.2 Filter by Selection This feature will filter records that contain identical data values in a given field such as filtering out all of the records that have the value "Clear Hill" in a name field. To Filter by Selection, place the cursor in the field to filter the other records by and click the Selection button on the group. In the example, the cursor is placed in the City field of the First record that displays the value "Altoona" so the filtered table will show only the records where the city is Altoona. 6-1 Version 1 Access 6.3 Filter by Form If the table is large, it may be difficult to find the record that contains the value to filter by so using Filter by Form may be advantageous instead. This method creates a blank version of the table with drop-down menus for each field that contain the values found in the records of that field. In the sample, the City field was selected for the filter. When applied, a drop down window appears with a list of the city names. When a city is selected, only records with that city will be displayed. 6.4 Saving a Filter The filtered contents of a table can be saved as a query by right clicking on the Filter by Form tab and selecting Save. The Save As Query menu appears. Enter a name for the query and click OK. The query is now saved within the database. 6.5 Remove a Filter The can be closed by right clicking on the Filter by Form tab and selecting Close. 6-2 Version 1 Access 7 Queries Queries select records from one or more tables in a database so they can be viewed, analyzed, and sorted on a common datasheet. The resulting collection of records is saved as a database object and can therefore be easily used in the future. The query will be updated whenever the original tables are updated. And, conversely, the tables will be updated anytime a related query is up dated. Types of queries are simple and crosstab queries that extract data from tables based on specified values, find duplicate queries that display records with duplicate values for one or more of the specified fields, and find unmatched queries display records from one table that do not have corresponding values in a second table. 7.1 Create a Query NOTE: The Relationship between the tables must be established prior to creating a query. The query must use the relationships to extract the correct data from each record within a table. Follow these steps to create a new query: From the Create tab, Other group, select the Query Wizard. Select the appropriate Query design wizard. 7-1 Version 1 Access 7.2 Simple Query Wizard For the example, the Simple Query Wizard was selected. Open the Tables/Queries window to select the Table that contains the information that is to be used. The available fields are displayed on the right. Select the fields and click on the > button to add them to the query. The >> button will add all of the fields to the query. Name the query and then click the Finish button. The query appears on the screen and is listed in the Navigation pane.. The query can also be viewed in the Design View format. Click on the Design View icon in the Home tab, Views group. The Design View of the query will be shown. 7-2 Version 1 Access The Design View permits the user to change the query display by changing the Show blocks. Any block that is clicked and the check mark is turned off, will not be displayed in the Datasheet View. The Design View also permits the user to establish additional criteria for the display of the information. 7.3 Find Duplicates Query This query will filter out records in a single table that contain duplicate values in a field. From the Create tab, Other group, select the Query Wizard. Select the appropriate Query design wizard. For the example, the Find Duplicates Query Wizard was selected. Open the Tables/Queries window to select the Table that contains the information that is to be used. The available fields are displayed on the right. Select the fields that may be duplicate and click on the > button to add them to the query. The >> button will add all of the fields to the window asks for the user to identify any additional fields that should be shown in addition to those with duplicate values. Name the query and then click the Finish button The query appears on the screen and is listed in the Navigation Pane.. 7-3 Version 1 Access 7.4 Delete a Query To delete a table from the query, Right click the query name in the Navigation Pane. Select Delete from the window. Delete 7-4 Version 1 Access 8 Forms Forms are like display cases in stores that make it easier to view or get the items that you want. Since forms are objects through which you or other users can add, edit, or display the data stored in your Access database, the design of your form is an important aspect. If you database is going to be used by multiple users, well-designed forms is essential for efficiency and data entry accuracy. Basics 8.1.1 Create Form To create a form, follow these steps: Click the Create tab. Click on the Form icon in the Forms group. The form appears on the screen. Since the User Query was active, the form is automatically created for that query. The form includes all of the fields that were in the query. To save the form, Click on the Save icon on the Quick Access toolbar. OR, right click on the tab title and select Save. A window appears where the name of the form can be entered. Then, click OK. 8-1 Version 1 8.1.2 Access Adding Records Using a Form At the bottom of the form screen, there is a status bar that identifies the current record and the total number of records in the table. The arrows permit the user to move to previous or next record as well as moving to beginning or end of the records. The arrow with an asterisk will take the user to a new, blank, record for entry of new information into the table. The Navigation pane (All Access Objects) displays all of the objects. Notice that the icon next to the entries identifies the type of object. Each object type has its own icon identifier. Table Form Report Query 8.2 Layout View When a Form is generated from an existing table or query, It displays the form in Layout format using all of the data in the table or query. The sample is shown in stacked format. visible grid is around the data and a box appears in the upper right corner. 8.2.1 A Resize columns The stacked format displays all data blocks in the same width. As shown, this is usually far bigger than is needed. It makes it easier to resize the data blocks by permitting the user to resize them all at the same time. Place the cursor over the right border of the highlighted cell. It should now be a two-way arrow. Drag to the right and the cell will all resize as needed. 8-2 Version 1 8.2.2 Access Remove Stacking Resizing the stack does not always produce the complete resizing effort and the stack continues to control activity on all data cells. To remove the stacking Click on the box in the upper right corner. Point to the edge of the highlighted area. The cursor should be a fourway arrow. Right Click and a help window appears. Click on Layout Click on Remove Layout. The fields are still highlighted, but the frame and stack control is removed. Click off the highlighted area and the highlighting is removed. Once the stacking control has been removed, the individual cells may now be resized as shown for the Middle Initial (MI). 8-3 Version 1 Access 8.3 Design View 8.3.1 Create a Form To create a form from scratch without the wizard, follow these steps: Click the Form Design icon on the Create tab, Forms group. Select the Forms Design Tools – Design tab. The Design tab contains all of the features needed to create a form. To use information from an existing table, select Add Existing Fields from the Design tab, Tools group. For the example; Select the User entry by clicking on the plus + next to the table name. The field names are then displayed beneath the table name. Double clicking on the table fields identifies them as fields to be entered into the form. They then appear on the grid with a field title entry and a field data entry. The basic design of the form is now completed. 8-4 Version 1 Access It is now possible to view the form in either the Design View or the Form View by opening the Views group and selecting the appropriate view. 8.3.2 Editing Forms The follow points may be helpful when modifying forms in Design View. Right click within the form Tab order - Alter the tab order of the objects on the form by selecting Tab Order... from the window. Click the gray box before the row you would like to change in the tab order, drag it to a new location, and release the mouse button. Grid lines - By default, a series of lines and dots underlay the form in Design View so form elements can be easily aligned. To toggle this feature on and off select Grid from the window. Fill/Back Color - Change the background color of the form by clicking the Fill/Back Color button on the window and click one of the color blocks on the palette. Change the color of individual form objects by highlighting one, right clicking and selecting a color from the Fill/Back Color palette or the Font/Fore Color palette to change the font color. The font and size, font effect, font alignment, border around each object, the border width, and a special effect can also be modified. Page Header/Footer - Headers and footers added to a form will only appear when it is printed. Access these sections by selecting Page Header/Footer on the window. 8-5 Version 1 Access 8.4 Forms Control Form Controls are part of the Forms Design Tools/Design tabs. Form controls are available including lists, combo boxes, checkboxes, option groups, and command buttons. The Controls group contains a number of actions that are used to build a form. The name of each option is displayed when the cursor is moved over that object or icon. Add controls to the form by clicking and dragging the field names from the Controls group. Access creates a text box for the value and label for the field name when this action is accomplished. To add controls for all of the fields in the Field List, double-click the Field List window's title bar and drag all of the highlighted fields to the form. 8.4.1 List and Combo Boxes If there are small, finite number of values for a certain field on a form, using combo or list boxes may be a quicker and easier way of entering data. These two control types differ in the number of values they display. List values are all displayed while the combo box values are not displayed until the arrow button is clicked to open it as shown in these examples: Combo Box List Box Academic 3 Ben Hill Griffin III Hall Reed Hall Academic 3 By using a combo or list box, the name of the academic building does not need to be typed for every record. Instead, it simply needs to be selected from the list. Follow these steps to add a list or combo box to a form: Open the form in Design View. On the Design tab, in the Controls group, ensure that Use Control Wizards is selected. Click either the List Box tool or the Combo Box 8-6 tool. Version 1 Access On the form, click where the list box or combo box are to be placed. Depending on the choice, the List Box Wizard or the Combo Box Wizard starts. The wizard asks how you want to get the values for the control, do one of the following: o If you want to display the current data from a record source, click I want the list box/combo box to look up the values in a table or query. o If you want to display a fixed list of values that will seldom change, click I will type in the values that I want. Continue to follow the wizard instructions to complete the box. Select the Table or Query that should provide the data and then click Next >. Choose field from the table or query that was selected. Click Next > to proceed. The selected field can be sorted in ascending or descending sequence. 8-7 Version 1 Access The width of the column can be adjusted to ensure the text is completely displayed. Click Next > to proceed. If the data entry is to be retained and entered into a field in the record, click on Store that value in this field and enter the field name. The last step is to provide a name for the combo or list box created. Click Finish to proceed. Returning to the Form View, the appropriate box is displayed. 8.4.2 Check Boxes and Option Buttons Use check boxes and option buttons to display yes/no, true/false, or on/off values. Only one value from a group of option buttons can be selected while any or all values from a check box group can be chosen. Typically, these controls should be used when five or fewer options are available. Combo boxes or lists should be used for long lists of options. Checkbox or option buttons can be added to the form using a wizard that provides all of the steps necessary to add one of these features to a form. 8-8 Version 1 8.4.3 Access Command Buttons A command button may be placed beside each record and is used to open another. Clicking on the Command Button icon opens a wizard that provides all of the steps needed to create the button. 8.4.4 Conditional Formatting Special formatting that depends on the control's value can be added to text boxes, lists, and combo boxes. A default value can set along with up to three conditional formats. To add conditional formatting to a control element, follow these steps: Select the control that the formatting should be applied to and select the Form Design Tools tab, Format tab, Control Formatting group and Conditional Formatting command. The Conditional Formatting Rules Manager window will open. This window can be used to add new rules, edit existing rules or delete rules. The Show Formatting rules for: block can be opened to select the specific field to be used for formatting. 8-9 Version 1 Access Select New Rule. Select the values or range that is to be formatted. Formatting can be set to change colors, background colors, fonts, etc. 8.4.5 Password Text Fields To modify a text box so each character appears as an asterisk as the user types in the information, Select the text field in Design View and click Property Sheet. Under the Data tab, click in the Input Mask field. Click the button [...] that appears. Choose "Password" from the list of input masks and click Finish. Although the user will only see asterisks for each character that is typed, the actual characters will be saved in the database. 8.5 Split Form A Split Form displays the datasheet in the lower portion of the screen and the form in the upper portion of the screen. Before It can be selected, the table or query that is to be displayed must be selected first. Then click on the Split Form icon on the Create tab, Forms group, More Forms. 8-10 Version 1 Access When the Split Form appears on the screen, it also displays a Field List on the right. It also opens the Form Layout Tools tab. The Forms Layout Tools tab provides additional formatting capabilities. The user is now able to see the form and the datasheet on screen at the same time. 8-11 Version 1 Access 9 Reports Reports will organize and group the information in a table or query and provide a way to print the data in a database. 9.1 Report A report can be created quickly from a table or query. Select the table or query and then click on the Report icon. The report will be displayed. The screen also displays the Field List and lists of fields that are available from related or other tables. The available field windows can be used to add additional fields to the report. 9-1 Version 1 Access 9.2 Report Wizard Create a report using Access' wizard by following these steps: Double-click the Report Wizard option on the Reports group Select the information source for the report by selecting a table or query from the Tables/Queries drop-down menu. o Select the fields that should be displayed in the report by transferring them from the Available Fields menu to the Selected Fields window using the single right arrow button > o Select the double arrow button >> to move all of the fields at once. o Click the Next > button to move to the next screen. To add any grouping of the information, o Select the field(s) for grouping o Click the right arrow button > to add those fields to the diagram. o Use the Priority buttons to change the order of the grouped fields if more than one field is selected. o Click Next to continue. If the records should be sorted, identify a sort order here. Select the first field that records should be sorted by and click the A-Z sort button to choose from ascending or descending order. Click Next > to continue. 9-2 Version 1 Access Select a layout and page orientation for the report Click Next >. Select a color and graphics style for the report Click Next >. On the final screen, name the report and select to open it in either Print Preview or Design View mode. Click the Finish button to create the report. 9-3 Version 1 Access 9.3 Report Design View To create a report without using the Report or Report Wizard options, select Report Design from the Reports Database Window. The Design View screen permits the user to create a report directly from the basic report shell. It also opens the Report Design Tools tab with Design, Arrange, Format and Page Setup sub tabs. This is a feature that will not be discussed at the beginning Access level. 9.4 Printing Reports Open the view pull-down from the Home tab, Views group. Select Print Preview. The Print Preview tabs opens. This tab contains all of features necessary to adjust size, margins and page setup. When the report is set up correctly, click on the Print icon 9-4 Version 1 Access 10 External Data The External Data tab is used to handle the import/export data functions 10.1 Importing To import or link data from another source use the Import group. In the example, the import from Excel will be used. Select Excel Use the Browse to select the Excel file to be imported. Click OK. If the workbook contains more than one worksheet, select the correct worksheet. The worksheet appears with tentative field breakouts. Click Next >. 10-1 Version 1 Access If the first row contains headings, click the block. Click Next >. Specify the Data Type for each field. NOTE: Always make school numbers a text field. Then leading zeroes all be displayed. Click Next >. Identify the field that is to be used as the primary key. Access automatically generates a new key value unless otherwise specified. No primary key is a valid step The last step is to name the new table and click on Finish. 10-2 Version 1 10.2 Access Exporting The effect of importing can also be achieved using the Export group. Select the table or query to be exported. The example will export to an Excel spreadsheet. Select Excel from the Export group. Select the File name and File format from the pull-down windows. Click OK. The export is completed. Check if the export steps are to be saved. Click Close. 10-3