Lesson 07: MS ACCESS - Handout Handout Introduction to database (30 mins) Microsoft Access is a database application. A database is a collection of related information put together in database objects. Ms Access is used to organise large data and present it in form of a table, report, form or query. First open Ms Access application, then a gray screen with a side bar menu will appear with the following options: New: Blank Database; Blank Data Access Page; Unlike Word documents, in ms access you must save an Access database before you start working on it. - After selecting Blank database, you will first be prompted to specify a location and name for the database. - Find the folder where the database should reside in the Save in drop-down menu. - Type the name of the database in the File name line and click the Create button. Screen Layouts Database Window organizes all of the objects in the database. The default table listing provides links for creating tables and will list all of the tables in the database once they have been added.
The layout has database objects on the left panel. These objects include tables, forms, reports and queries. A table : a grouping of related data organized in fields (columns) and records (rows) on a datasheet. By using a common field in two tables, the data can be combined. Many tables can be stored in a single database. A field: a column on a datasheet and defines a data type for a set of values in a table. For a mailing list table might include fields for first name, last name, address, city, state, zip code, and telephone number. A record :a row on a datasheet and is a set of values defined by fields. In a mailing list table, each record would contain the data for one person. A Query: A "query" refers to the action of instructing the database to return some (or all) of the data in your database. A Form: Microsoft Access forms provide a quick and easy way to modify and insert records into your databases. They offer an intuitive, graphical environment easily navigated by anyone familiar with standard computer techniques. A Report: Reports are similar to queries in that they retrieve data from one or more tables and display the records. Unlike queries, however, reports add formatting to the output including fonts, colors, backgrounds and other features. Reports are often printed out on paper rather than just viewed on the screen A Macros: A set of instructions stored in an executable form. Macros may be application specific (such as a spreadsheet or word processing macro that performs specific steps within that program) or general-purpose (for example, a keyboard macro that types in a user ID when Ctrl-U is pressed on the keyboard).
Tables can be created either in design view or datasheet view. Design View provides the tools for creating fields in a table. Datasheet View allows you to update, edit, and delete information from a table. Below is the design view window. Design View customizes the fields in the database so that data can be entered. Field Name - This is the name of the field and should represent the contents of the field such as "Name", "Address", "Final Grade", etc. Data Type - This is the type of value that will be entered into the fields. Text- The default type, text type allows any combination of letters and numbers up to a maximum of 255 characters per field record. Memo - A text type that stores up to 64,000 characters. Number - Any number can be stored. Date/Time - A date, time, or combination of both. Currency - Monetary values that can be set up to automatically include a dollar sign ($) and correct decimal and comma positions. Check below
Datasheet View allows you to enter data into the database. Primary Key: A primary key is a single field or combination of fields that uniquely defines a record. None of the fields that are part of the primary key can contain a null value. A table can have only one primary key. Indexes: An index helps Microsoft Access find and sort records faster. Access uses indexes in a table as you use an index in a book: to find data, it looks up the location of the data in the index. Insert /delete row: For adding or deleting a row. Properties: When clicked will open the tables properties whereby you can set validation rule, validation text etc. Field builder: This will help you create fields in tables. Database window: This button will take you to the primary window visible in Access where you can view or design all objects such as tables, queries, and other objects New object: Gives you an option to create forms, tables, query, reports etc. Creating a query Ms Access has the ability to filter data from a table or form by running queries.
A "query" refers to the action of instructing the database to return some (or all) of the data in your database. Creating a query The From the Queries page on the Database Window, click the New button. Select Design View and click OK. Select tables and click the Add button to add each one to the new query. Click Close when all of the tables and queries have been selected. Add fields from the tables to the new query by double-clicking the field name in the table boxes or selecting the field from the Field: and Table: drop-down menus on the query form. Specify sort orders if necessary. Enter the criteria for the query in the Criteria':' field. After you have selected all of the fields and tables, click the Run button on the toolbar. Save the query by clicking the Save button. Note: To create a query you must click on the run command (!) shown on the tool bar above. Creating a form using the form wizard (10 mins) A form is used to enter or view information in a table. It is also used to add or delete data in the table. To create a form, the following steps are followed; In the database window, select New Form. Create a New Form by using a Wizard. 1. Select the fields that would appear in the form. 2. Follow the wizard and select a design.
Go to Design View to edit/add to the form, a tool box should appear on the screen. Create a combo box in order to have a scroll down menu option. After creating the Form in Design View, in order to edit/add records you must first change the view type to Form View as shown below.