xp 1 microsoft access 2003 introduction to microsoft access 2003

79
1 XP Microsoft Access 2003 Introduction To Microsoft Access 2003

Upload: justin-cunningham

Post on 16-Jan-2016

234 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

1

XP

Microsoft Access 2003

Introduction To Microsoft Access 2003

Page 2: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

2

XPDefine some key Access terminology

• Field – A single characteristic or attribute of a person, place, object, event, or idea.

• Record – A set of related field values.• Table – A collection of records that identify a

category of data, such as Customers, Orders, or Inventory.

Page 3: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

3

XPIllustration of fields, recordsand a table

Page 4: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

4

XPRelational database and keys

• A relational database is a collection of tables that are related to one another based on a common field.

• A field, or a collection of fields, is designated as the primary key. – The primary key uniquely identifies a record in the

table.

• When the primary key of one table is represented in a second table to form a relationship, it is called a foreign key.

Page 5: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

5

XPRelating tables using a common field

Page 6: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

6

XPOpen an existing database

• To open an existing database, you must first start Access.

• When Access is launched you will see the Access window, with the task pane on the right side of the window.

• From the task pane you can open an existing database by selecting the database you want from the list of Recently opened databases

Page 7: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

7

XPThe Access window

• When a database is opened, the Access window and the Database window will be displayed.

• The Access window contains a menu bar, a toolbar, a task pane, and a status bar.

• In the Access window, use the task pane to create a new database or to open an existing database. – To create a new database, make a selection from the New section

of the task pane

– To open an existing database, select from the list of Recently opened databases or from the More files option

Page 8: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

8

XPThe Database window

• The Database window is the main control center for working with an Access database.

• The Database window contains a menu bar, an objects bar, and a groups bar.– The Objects bar lists all the objects available in the

database – The list of objects consists of tables, queries, forms,

reports, pages, macros, and modules – You can click on any of the objects in the Objects bar

to obtain a list of objects of that type

Page 9: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

9

XPUse the task pane to open a database

Page 10: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

10

XPOpen an Access database table

• To open a table you must first open a database: – In the database window, select Tables on the objects

bar

– In the list of tables, select the table you want to open and click on the Open button

– When a table is open it is in Datasheet view, which shows the table's data as a collection of rows and columns

– Each row in the Datasheet view represents a record in the table

Page 11: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

11

XPNavigate a database table

• You can navigate through the records by using the navigation buttons displayed at the bottom of the Datasheet view window.

• The navigation bar allows you to:– Go to the first record in the table– Go to the previous record in the table– Go to the next record in the table– Go to the last record in the table– Create a new record for the table (sometimes called an

append record)

Page 12: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

12

XPA table in datasheet view

Page 13: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

13

XPThe navigation bar buttons

Page 14: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

14

XPWhat is an Access query?

• If you want to see just a portion of the data in a table you can create a query.

• A query is a question you ask about the data stored in a database table.

• Access responds by displaying the data according to your question. – For example, if you ask to see all the customers from

New York, the response would be to display only the records whose state field matches with NY

Page 15: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

15

XPOpen an existing query and create new queries

• You can open an existing query by clicking Queries on the Objects bar and then selecting the query you want to open.

• You can also create your own queries by clicking New on the Database window.

• To create a new query, you can use the Simple Query Wizard, which will bring you through the selections you want for your query.

Page 16: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

16

XPNavigating a query and sorting the results

• When you run and get the results of your query, you can reorganize the data by sorting the datasheet in either ascending or descending order.– Click the pointer anywhere in the column you wish to

sort– Click the Sort Ascending or Sort Descending buttons

on the Query Datasheet toolbar to sort the results in the desired sequence

• You can navigate through the records by using the navigation buttons on the Navigations toolbar.

Page 17: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

17

XPSample Query Datasheet view

Page 18: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

18

XPSelecting fields to include in a query

• You can create a query that will display only selected fields from a table instead of displaying all fields.

• In the Simple Query Wizard dialog box, select which fields you want included in the query. – Move all the fields into the Selected Fields box– Move the fields one at a time – Remove fields out of the Selected Fields box by pressing one of

the remove buttons • If you wanted to select all the fields except one, you can

move them all to the selected fields list and then remove the one field you don't want.

• Once you have made your selections, press Next to move to the next dialog box in the Wizard.

Page 19: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

19

XPThe Simple Query Wizard

Page 20: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

20

XPCreate an Access form

• A form allows you to view your data one record at a time.

• Forms are useful for maintaining, viewing, and printing records in a database.

• You can create your own form in the Forms Design window or you can use the Forms Wizard to create a form.

• The easiest way to create a form is to use the AutoForm Wizard.

Page 21: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

21

XPUse the AutoForm Wizard

• The AutoForm Wizard uses a table (or query) you select as the basis to create a form that displays all the fields of the table (or query).

• Once you have created your form, you can view the records one record at a time.

• The form has a navigation bar just like the navigation bar you have already used in the Table or Query Datasheet view.

Page 22: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

22

XPAccess Form View

Page 23: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

23

XPCreate, preview, and navigate a report

• You can create a report, which is a printed version of your data, that is formatted according to your specifications.

• The data in the report can consist of data from a single table or multiple tables.

• Access has a Reports Wizard that allows you to easily create a report.

• The report can be based on a table or it can be based on a query. – If the report is based on a query, it will contain the same fields that

were selected for the query

Page 24: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

24

XPThe Report Preview window

Page 25: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

25

XPBackup and restore a database

• You may want to create a backup of your data so that if you lose or damage your database, you can recover from the backup.

• You can use a backup tool, such as the Microsoft backup tool, or some other backup program.

• To restore the data from the backup, you need to use the same backup tool according to the instructions associated with that tool.

Page 26: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

26

XPLearn the guidelines for designing databases

• When designing a database, first try to think of all the fields of data that needs to be stored.

• Next, group the fields into tables. Each table will contain a group of related fields.

• You need to select a field in each table to become the primary key for that table.

• When tables will be related to one another, you need to include a common field in the two tables that will be used to form the relationship.

Page 27: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

27

XPDetermining database fields

Page 28: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

28

XPGroup the fields into tables

Page 29: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

29

XPChoose a primary key

• Choose a field or fields to serve as the primary key for the table.

• A primary key must uniquely identify each record in the table.

• Primary keys can consist of more than one field.– Primary keys with more than one field are called

composite keys

Page 30: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

30

XPInclude a common field

• When one table needs to be related to another table, you must include a common field.

• The common field will be the primary key in one table.

• The common field is referred to as a foreign key in the related table.

• The foreign key in a table can then be used as a primary key to access the record in the related table.

Page 31: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

31

XPData redundancy wastes space and can lead to data errors

Page 32: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

32

XPSetting field properties

• When assigning a name to any object in Access, carefully select a name that will indicate what data is stored there.

• Field properties include their data type, field sizes, and an optional description of the field.

• When selecting a field size, make sure the size is big enough to hold the largest piece of data that will be stored there.– Do not make the field larger then necessary because this will result

in wasted disk space

• Make sure the data type you select for a field is appropriate for the kind of data to be stored in that field.

Page 33: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

33

XPAccess field types, slide 1

Page 34: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

34

XPAccess field types, slide 2

Page 35: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

35

XPCreate a new database

• You can create a new database by using a Database Wizard or by creating a new, blank database.

• When you create a new database, you will need to create all the tables, queries, forms, and reports for the database. – This is the most flexible approach, since you will create

all objects yourself

Page 36: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

36

XPCreate a database without using the Database Wizard

• To create a new, blank database without using the Database Wizard:– Start Access

– Click Blank Database in the task pane

– In the dialog box, navigate to the location where you will save your database

– Enter the name of the database in the File name text box

– Click the Create button

Page 37: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

37

XPCreate a new table

Page 38: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

38

XPDefine fields, and specify a table's primary key

• When you create a table, you name the fields and define the properties for the fields. – The table structure is set up and modified in Design View

– In Design View, you will define each field that will be included in the table

• When all the fields have been defined, you will then specify which field(s) will be the primary key. – The primary key is not mandatory, but it is a good idea to assign one

Page 39: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

39

XPThe database Design View window

Page 40: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

40

XPChoosing a primary key

Click a row selector for the field you want to use as the primary key, and then click the Primary Key button on the toolbar.

After clicking the Primary Key button, a key symbol appears in the row selector to indicate the key field.

Page 41: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

41

XPSave the new table

• When all fields have been defined and properties have been set, you must save the table structure:– Click the Save button on the Table Design toolbar

– Type the name you want to assign to the table into the Table Name text box of the Save As dialog box

– Click the OK button to save the table using the specified name

Page 42: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

42

XPAdd records to a table using Datasheet View

• Once the table has been created, you can then add records to the table using Datasheet View.

• As you enter records, they will be placed in the order in which you enter them. However, when you close the table and open it again, the records will be ordered according to the primary key order.

• The navigation bar at the bottom of the Datasheet view will indicate how many records are in the table and what the current record is (i.e., the record on which your cursor currently rests).

• You can move through the fields in the table by pressing the Tab key. • Once your cursor is moved off a record, that record is automatically

saved on your disk.

Page 43: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

43

XPDatasheet View with 2 records added

Page 44: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

44

XPModify the structure of a table by deleting, moving, and adding fields

• The structure of a table can be modified after it has been created.

• To delete a field, enter Design View, right-click on the field, and then click Delete Rows on the drop down menu.

• To move a field, (you also do this in Design View) click on the field you want to move, and while holding your mouse button down, move the field to the desired location.

• To add a field in Design View, right-click the field where you want to insert the new field and then click Insert Rows on the dropdown menu.

Page 45: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

45

XPMoving a field in Design View

Page 46: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

46

XPAdding a new field in Design View

1. Right-click the row selector for the field you want to insert the new field in front of--StartDate in this figure.

2. Select Insert Rows from the shortcut menu, and a new, blank row will be inserted before the row you selected, as shown below.

3. Enter the information for the new field.

Page 47: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

47

XPChange field properties

• You can make additional modifications to the structure of a table by changing the properties of the table's fields. – For example, if you have a field that represents a currency value but you

do not want to display dollar signs, you could change the format to a standard format

– In the Design View, you will find a list of all formats available to you. You can make a selection from the list of options

– Each data type has a separate set of options available in the Field Properties portion of the Table Design Window

• Field properties are changed in the Design View window.

Page 48: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

48

XPChanging field properties in Design View

Page 49: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

49

XPCopy records from another Access database

• If the data you want in your database already exists in another Access database, you can copy the records from that database into your database.

• You can use cut and paste to do this: – Open the database that contains the records you want to copy

– Select the records you want to copy and then press the Copy button. This places the records onto the Windows clipboard

– Open the database to which you want to copy the records and open the desired table to receive the copied records

– Place your cursor on the next available row in the table and press the Paste button

Page 50: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

50

XPDelete and change records

• Once records have been added to a table, they can be deleted or modified:– In Datasheet view, click the row selector for the record(s) you want to

delete and then click the Delete Record button on the toolbar

• To change or modify a record:– Place your cursor on the record and then on the field you want to change – You can then edit the field's value as you wish by typing in new data

• You can switch from navigation mode to editing mode depending on what you want to do at the time. – When you are editing a record, you are in editing mode, Otherwise you

are in navigation mode– Editing mode is indicated by a pencil symbol in the left margin of the

datasheet view

Page 51: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

51

XPAn alternate method for deleting a record

Page 52: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

52

XPKeystroke techniques for navigation and editing modes

Page 53: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

53

XPCreate, run, and save queries

• From the fields list, either drag or double-click fields that you want included in the query. – A query result differs from a table's datasheet view in that only

selected fields are displayed • If you move a field to the design grid and then you want to

remove it, you can click on the field's column and then press the delete key.

• The results of the query will be displayed in order by the primary key of the table unless you specify another sort order.

• You can save the query and give it a name by pressing the save button on the toolbar.

Page 54: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

54

XPSelecting, displaying and sorting fields

Page 55: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

55

XPA sample query datasheet

Page 56: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

56

XPSort data in a query

• You can control the order of data displayed in a query by altering the queries sort key.

• Choose a field on which you want the data to be sorted and then specify whether you want the data sorted in ascending or descending order.

• Specify multiple fields as the sort key if you want to arrange data in sorted order within groups of data.

• Specify sort criteria for the query in the query design grid.

Page 57: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

57

XPSort results by data type

Page 58: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

58

XPUse the And and Or logical operators

• When you need to use multiple conditions for a query, you can use the logical operators to combine conditions. – The And logical operator specifies that both conditions must be met

– The Or logical operator specifies that one or the other of the conditions must be met

• When you enter two conditions on the same row of the query design grid, an And condition is created.

• If you enter two conditions that are on separate rows, an Or condition is created.

Page 59: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

59

XPIllustration of And and Or logic

Page 60: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

60

XPCreating And conditionin the design grid

Page 61: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

61

XPCreate a form using the Form Wizard

• You can create a form from scratch or you can create a form using the Form Wizard.

• The Form Wizard will lead you through a series of choices to help you develop the form based on a table or a query.

• You will need to select the type of layout you want for your form, the style of the form, and a name for the form.

• After you have selected the table or query on which the form will be based, you will select which field(s) will be used on the form.

Page 62: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

62

XPOpen the Form Wizard dialog box

Page 63: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

63

XPUse Form Wizard to choose a form layout

Page 64: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

64

XPUse Form Wizard to select a style for the form

Page 65: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

65

XPCompleted Form

Page 66: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

66

XPChange a form's AutoFormat

• You may want to change the appearance of a form after it has been created with the Form Wizard.

• Clicking on the AutoFormat button and then make your selection.

• Click the button beside each format to view a sample of that particular format.

• Once you have decided on a format, click OK.

Page 67: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

67

XPA completed form created with the Form Wizard

Page 68: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

68

XPThe AutoFormat dialog box

Page 69: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

69

XPFind data using a form

• You can navigate through all the records in a form, but you may want to find a particular record more quickly.

• The Find command allows you to specify the record you want to see and then will navigate directly to that record.

• To use the Find command: – Place your cursor in the form on the field for which you want to search

– Press the Find button and enter the value you are looking for

• The form will display the record(s) that match your Find criteria.

Page 70: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

70

XPSetting up a Find operation

Page 71: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

71

XPAn example of a Form with subform

Page 72: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

72

XPCreate a report using the Report Wizard

• You can easily create a formatted printout of data in table(s) in a database by using the Report Wizard.

• The Report Wizard will ask you a series of questions to help you format the report.

• Once the report has been created, either with the Report Wizard or your own design, you can change the design later.

• You will find that the choices you make in the Report Wizard are similar to the choices in the Form Wizard.

• Choices include grouping and sorting options, as well as report layout options. You can preview the report to view how it will look when printed.

Page 73: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

73

XPGrouping report data

Page 74: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

74

XPSorting report data

• You can sort the data on a particular field or on several fields.

• If you choose to sort on two or more fields, the grouping is in order as selected on the Sort Order portion of the Report Wizard. – If you choose to sort on State and then on City, the

report would be sorted on State and then within each State group, the data would be sorted on City

Page 75: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

75

XPThe Report Wizard Sort dialog box

Page 76: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

76

XPChoose a report layout

Page 77: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

77

XPInsert a picture in a report

• You can insert a picture into a report to improve its appearance.

• The picture can be from scanned images, images created in Microsoft Paint, or a picture created in some other graphic program.

• Once the picture is inserted into the report, you can move it around and size it to your preference.

Page 78: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

78

XPInsert a picture

• The picture you insert must be created before you try to insert the picture.

• Be sure you know where the picture is located on your disk before you begin to insert the picture. To insert the picture:– Click Insert on the menu bar

– Select Picture from the drop-down menu

– Navigate to the location of the picture and select it

– Press the OK button to insert it

Page 79: XP 1 Microsoft Access 2003 Introduction To Microsoft Access 2003

79

XPMoving a picture in a report