38
MICROSOFT OFFICE ACCESS - Is known as a desktop database system because its functions are intended to be run from a single computer. - Uses database – a collection of data and objects related to a particular subject, which is organized and categorized by tables - It is a Relational Database Management System (RDBMS), because it stores information in multiple related tables and can be treated as a single storage area and pull information electronically from different tables in whatever order meets your needs; designed primarily for home or small business usage - Previously known as Microsoft Access, is a database management system from Microsoft that combines the relational Microsoft Jet Database Engine with a graphical user interface and software-development tools. MS ACCESS Features - Users can create tables, queries, forms and reports, and connect them together with Macros Macros in Access can be thought of as a simplified programming language which you can use to add functionality to your database. It contains actions that perform tasks, such as opening a report, running a query, or closing the database. Most database operations that you do manually can be automated by using macros. - Access also has report creation features that can work with any data sources that Access can “access”.

MS Access 2007

  • Upload
    issa-go

  • View
    6.689

  • Download
    2

Embed Size (px)

DESCRIPTION

This file contains the basic information about MS Access 2007, what is its purpose of usage, how to use it and some examples of simple databases.

Citation preview

Page 1: MS Access 2007

MICROSOFT OFFICE ACCESS- Is known as a desktop database system because its functions are intended to be run from a

single computer. - Uses database – a collection of data and objects related to a particular subject, which is

organized and categorized by tables- It is a Relational Database Management System (RDBMS), because it stores information in

multiple related tables and can be treated as a single storage area and pull information electronically from different tables in whatever order meets your needs; designed primarily for home or small business usage

- Previously known as Microsoft Access, is a database management system from Microsoft that combines the relational Microsoft Jet Database Engine with a graphical user interface and software-development tools.

MS ACCESS Features- Users can create tables, queries, forms and reports, and connect them together with

Macros Macros in Access can be thought of as a simplified programming language which you

can use to add functionality to your database. It contains actions that perform tasks, such as opening a report, running a query, or closing the database. Most database operations that you do manually can be automated by using macros.

- Access also has report creation features that can work with any data sources that Access can “access”.

- Other features include: the import and export of data to many formats including Excel, Outlook, ASCII, dBase, Paradox, FoxPro, SQL Server, Oracle, ODBC, etc.

- It also has the ability to link to data in its existing location and use it for viewing, querying, editing, and reporting.

- It can perform heterogeneous joins between data sets stored across different platforms. It is often used by people downloading data from enterprise level databases for manipulation, analysis, and reporting locally.

- Microsoft Access offers parameterized queries. These queries and Access tables can be referenced from other programs like VB6 and .NET through DAO or ADO. From MS Access, VBA can reference parameterized stored procedures via ADO.

- Microsoft Access is a file server-based database. Unlike client-server relational database management systems, Microsoft Access does not implement database triggers, stored procedures, or transaction logging.

Page 2: MS Access 2007

MS Access vs MS Excel MS Excel

Spreadsheet Flat database all information has a one-to-one relationship

MS Access like multiple spreadsheets that are connected to one another

one-to-many relationships many-to-many relationships

Examples Printed Phone Directory (White Pages)

Flat Database: one-to-one relationships Library Catalog

Relational Database: Many-to-many relationships** Library patrons check out many books** Books are checked out by many patrons

University Class Schedules Students have many professors. Professors have many students Classes can be held in many classrooms

Page 3: MS Access 2007

Working in Access 2007When you create or open a database, it opens in a database window. The new Access database window interface is designed to more closely reflect the way people generally work with a database or database object.

The interface includes the following elements: Microsoft Office Button – when clicked, contains the commands related to managing

databases (such as creating, saving, printing, backing up, and publishing) Quick Access Toolbar – displays some commands that are represented by buttons; by

default, it displays Save, Undo, and Redo buttons, but you can add commands here Title bar – displays the name of the active database object and the Minimize, Maximize

and Close buttons Ribbon – new representation of commands rather than the more-traditional menus or

toolbars; organized into task-specific tabs, which are further divided into feature-specific or task-specific groups of commands

Navigation Pane – displays filtered lists of database objects; you can change the objects included in the list by clicking the list header and then clicking the category or group of objects you want to display.

Microsoft Office ButtonQuick Access Toolbar Ribbon Title Bar

Navigation Pane Document Window

Page 4: MS Access 2007

Exercise #1

Exercise #2

1. Name both tables.2. Establish a primary key for each table.3. Create a relationship between the two tables.4. Set appropriate properties for all fields.5. Enter at least five mock student records in Table One. In Table Two, enter at least three

courses for each students listed in Table One.6. The tables must contain the following information:

Table 1 Table 2Student ID Student IDFirst name CourseLast name Letter gradeGenderPhone numberAddressMajorMinor

Page 5: MS Access 2007

7. Create a report containing ID numbers, first names, last names, courses, and letter grades for all students.

8. Create a query to search for students with all course grades above B. Display the ID number, first name, and last name in the query.

Exercise #3

1. Create a new database, save it on the desktop and name it “School Database”2. Create a Table in the School Database with the following:

Field Name Data Type Field Size or FormatID Number Text 10Name Text 15Surname Text 15Telephone Number Number Long IntegerDate of Birth Date/Time Medium DateStipend Currency CurrencyForeigner Yes/No Yes/No

3. Make the “ID Number” Field as the Primary Key.4. Save the table as “Student’s Table”5. Return to the main Access window.

1. Open the “Students Table” and enter 5 complete records.2. Sort the table in ascending order by surname3. Move the Date of Birth and Telephone Number fields so that the Date of Birth field is now directly after the Surname field.4. Delete the last Record you have entered5. Change the field size of the Surname to 20

1. Create a Form with all fields on the Student’s Table.2. Name the form Students Entries3. Make the ID Number of Each student in the form, Red4. Insert a Picture in the form in way that all text is visible.

1. Create a report based on the Student’s Table showing the Fields Name, Surname, and Telephone Number.2. Name the report Telephone List3. Insert a picture in the report Header

1. Create a query, showing all fields of those students who have a particular surname of your Choice.

2. Create another query showing all fields of those students born after 1987.3. Create a query showing only the Student’s Name, Surname and Date of birth.

Page 6: MS Access 2007

Exercise #4Create a Table

1. Create a table in Access that looks like the table below (Create tab > Table [in Tables group]).

Figure 1 – Table

Note: the ID field can be any unique number. When you’re entering data, the ID field automatically increments. a. Save the table as tblStudents. Note: To change the ID, go to Design View. In the Data Type field, change AutoNumber to Number, then Save (Go to View > Datasheet View > in ID column, manually type in 1, 2, etc., Save).

2. Create a query that displays the first name, last name and city of students from California (page 13 of this guide discusses queries) [Create > Query Design].

a. Save the query as qryCAStudents. 3. Create a form using the Form Wizard. Refer to page 16 if needed. [Create > More Forms

in Forms group > Form Wizard).a. Use tblStudents to create the form.b. Include all the fields.c. Use the Columnar layout.d. Save (title) the form as frmStudents.

4. Create a report using the Report Wizard. Refer to page 17 if needed. [Create > Report Wizard in Reports group].

a. Use tblStudents to create the report.b. Include the following fields:

• First Name• Last Name• ID Number• Class Standing

c. Sort the records by Last Name.d. Save the report (title) as rptStudentSummary.

5. You should have the following tables created in the Shutter bar when you’re done with the exercises.

Page 7: MS Access 2007

Figure 2 - Tables Created

Exercise #5Record Entry with Properties

1. In the Database Window, double-click the STUDENTS table (this is a quick way to open a table in Datasheet View).

2. The student record you entered before will be displayed. Click in the Last Name field underneath Robbins.

3. Type Stevens for the Last Name and press [Enter]. 4. Type Sarah for the First Name and press [Enter].

As soon as you begin entering a date in the Date of Birth field, the Input Mask will appear.

5. We will test the Validation Rule by entering a date that’s not accepted. Enter a future date such as 020809 (remember you won’t need to enter the / since the input mask puts them in there for you). As soon as you press [Enter], the Validation Rule will recognise that the entry is invalid and the Validation Text will appear.

6. Click OK to clear the message. You won’t be able to proceed until you enter a valid date or press [Esc] to cancel the entry. Enter 100489 (10/04/89) for the date and press [Enter] to proceed to the next field.

7. Enter 24 Browne Ave for the Address Field and Yokine for the Suburb field. 8. Enter 6060 for the Postcode field (notice the input mask in this field). 9. Notice that the Default Value for the State field (WA) has already been entered. To test

the Validation Rule, enter NY as the State. The Validation Text will tell you that only Australian states can be entered.

10. Type WA for the State and press [Enter] (The Input Mask used for this field automatically converts entered text to uppercase).

11. For the final four fields, enter the information shown below. Phone Gender Mark Comment(08)92498127 Female 62 New Student

12. Close the table when complete. 13. The new data will be saved automatically in the Database.

Exercise #6Data Entry Using a Form

1. From the Database Window, make sure the STUDENTS table is selected.

Page 8: MS Access 2007

2. From the Insert menu, select AutoForm or click the icon on the toolbar. A form will be created automatically using the Fields and Records from your table. You can move from one record or Field to another using your mouse or the keyboard.

3. Use any of the above methods to move to a new, blank record.4. Complete the form. 5. Use the form to add the records 4 to 6 as shown below.

Student Number; Last Name; First Name; Date of Birth;Address; Suburb; Postcode; State; Phone; Gender; Mark; Comment1. 1; Robbins; Mark; 17-06-89;

4 Kensington Ave; Dianella; 6059; WA; (08)93751234; Male; 782. 2; Stevens; Sarah; 10-04-89;

24 Browne Ave; Yokine; 6060; WA; (08)92498127; Female; 62; New student3. 3; Andrews; Claire; 01-11-89;

322 Walter Rd; Morley; 6059; WA; (08)92751937; Female; 584. 4; McKay; Tim; 02-08-89;

54 Coode St; Dianella; 6059; WA; (08)93755610; Male; 34; Need to try harder5. 5; Petersen; Robert; 28-03-89;

230 Flinders St; Yokine; 6060; WA; (08)92497128; Male; 836. 6; Sanders; Jemma; 30-05-89;

183 Grand Prom.; Bedford; 6062; WA; (08)92739182; Female; 917. After you have entered the last record, close the form. You will be prompted to save. 8. Since this was only a temporary table to use for data entry, click No. 9. Open the table and you will see the new records listed.

Exercise #7Part 1: Create a database

1. Open Microsoft Access 2007 from the Start menu on your computer. (Note: If you are continuing from DB-2 you will want to close out of Access as DB-2 suggests, then reopen it as stated in this step. If you do not do this, you will not see the screen below.)

2. In the Template Categories pane on the left, click Business. 3. You see the Business database templates in the middle of the page. Click Contacts. 4. On the right side of the page, you see information about the Contacts database

template. In the File Name box, name your database Training Contacts.accdb. Then click the folder icon next to the name and be sure to select the 133DB folder on your USB drive, click ok. Then to save to your USB drive Click Download (or Create Button). (If a Microsoft Office dialog box come up click continue)

5. There's your database, with the Contact List form open. (If you see a window asking you for feedback, close it.)

Page 9: MS Access 2007

Part 2: Create a table

1. Press F11 to open the Navigation Pane. Click the downward-pointing triangle in a circle at the top of that pane.

2. In the list that opens, click Object Type. These are the objects created for you in this pre-built database.

3. Suppose you want a table in which you can list tasks that you're assigning to these contacts. On the Ribbon, click the Create tab.

4. In the Tables group, click Table Templates. In the list of templates, click Tasks. 5. Access 2007 adds a table to the Training Contacts database. The table opens in

Datasheet view called Table1, and you can see from the field names that this table is designed for tasks.

6. Above the field names is a tab for this new table, with the table's temporary name in it (Table1). Right-click that tab, click Save, and name the table Training Tasks when you save it. Click OK.

7. The name in the tab changes. Next to this tab is another for the Contact List form. You can use either these tabs or the Navigation Pane to switch from one database object to another.

8. At this point, if you notice a field List box you may close it by clicking on the close ―x‖ to the upper-right of the box. You may or may not see this.

9. Also, if you see a Security Warning like the one shown click the close ―x‖ to the far right of the warning to close it.

10. Right click the Training Tasks tab then select close to close it. 11. Do the same for the Contact List tab to close it. 12. You should now have no open database objects and the Navigation Pane should be

open.

Part 3: Enter data into tables

1. At this point you have two Tables listed in the Navigation Pane, called Contacts and Training Tasks. They currently have no data stored in them.

2. Let‘s input some data in the Contacts table. Open the table Contacts by double clicking the table in the Navigation Pane. You should now see the Contacts tab open showing the table.

3. Enter these two records listed below along with ONE additional friend (or made-up person). Start by clicking on the Company name field and key “Delta College”, press the tab key to move to the next field, then key the last name “Wyzkiewicz” and so on till you get to the last field… Then start keying the second record (always tab past ID because it is automatically generated and is the key field. It will always be a unique number probably starting with 1, 2, 3, and so on…) Lastly, key a third record of your choice.

Page 10: MS Access 2007

4. When you are finished, the table Contacts is now populated with three records. It should look something like this.

5. Now let‘s input some data in the Training Tasks table. 6. In the Navigation Pane double click the Training Tasks table to open it. Notice that it is

an empty table. 7. Just like the previous table, enter the two records listed below. Again the ID field is the

key field and does not need data entered. Just tab past it and an auto-number will be assigned. Save time when entering the Priority and Status fields by entering the data by using the pull-down arrow within the field instead of typing in these fields.

Part 4: Create and format a form

Page 11: MS Access 2007

1. If the Training Tasks table is not open, click its tab or select it in the Navigation Pane to open it. On the Ribbon, if the Create tab is not selected, click it.

2. In the Forms group, click Form. This will create a new form. 3. Easy, wasn't it? The new form has controls matching the fields in the table you based it

on. And the new form has the same name on its tab as the table you based it on. 4. You should also note that it uses the same data as the underlying table you based it on.

Any records you type in the Training Tasks table will show up in the Training Tasks form. 5. Save the form the same way you saved the table (right-click the Training Tasks tab then

save), and then you will see Training Tasks under Forms in the Navigation Pane. 6. The new form is open in Layout view, and you can see Form Layout Tools on the Ribbon,

with the Format and Arrange tabs.7. Click the Priority label within the Form. In the Font group, click Bold and Font Color to

make the label more visible (Red). You see the changes in the form as you make them. Have a little more fun if you like.

8. Change over to Form view. Form view allows you to page through the records while not allowing any editing of control objects. You do this by clicking on the View button. But first, note the View button has two positions. Do not click the view button yet, simply mouse over it now. Note the two positions, upper and lower positions.

9. The Upper button is a toggle between Form view and Layout view. These are the most important views in this object.

10. But let‘s do this. Now click on the lower portion of the view button, you will see a pull-down menu. This shows all views available for an object. Select Form view from the list.

11. Page through the two records in the Form by pressing the PageUP and PageDown keys several times on your keyboard. You will move from field-to-field then to other records in the form. Again, note the same data you typed in the table now comes through the form.

12. Click the lower portion of the view button then select Design View from the pull down menu. Design view allows you to change many graphical aspects of the form.

13. In the Form Header located at the top, Click to insert the word ―Important‖ before the words ―Training Tasks‖. The new heading should say ―Important Training Tasks‖.

14. Click the lower portion of the view button and select Form view. You should be in form view now. Look at the picture below. (Note : depending on your screen size your form data may not be in two columns as shown.)

Part 5: Create and format a report

1. Without closing the Training Tasks form, click the Create tab. 2. In the Reports group, click Report. 3. There it is, in Layout view, with the Report Layout Tools — the Format, Arrange, and

Page Setup tabs — visible on the Ribbon. And the object tab says Training Tasks. 4. If you see a property sheet like the one above, it is not needed. You can close it by

clicking the close (x) button to the right. This property sheet is used to set properties of each control on the report and is not needed at this point.

Page 12: MS Access 2007

5. The form is currently in Layout view. It shows the actual printed page borders. 6. Save the Report by right-clicking the Training Tasks tab, then select save from the list.

Use the default name Training Tasks, click OK. 7. Note, in the Reports section of the Navigation Bar you will see the Training Tasks report. 8. Open another report. Open the Contact Address Book report by double-clicking it the

Navigation Bar within the report section. This is a pre-formatted report that shows only address information. You will notice that this report is alphabetized by last name with some nice formatting. This is a good example showing you some of the features with reports in Access.

9. Open another report. Open the Contact Phone List report by double-clicking it in the Navigation Bar within the report section. This is a pre-formatted report showing only contact phone numbers. Again, you will notice that the report is alphabetized. Both reports are based on the data from the Contacts Table.

Exercise #8

PART I – THE FILE STRUCTURESOur database shall be to keep track of salespersons in a company. The SALESPERSON table shall be made up of the following fields:

Field Name Data Type Width Other InfoSalesperson ID Auto number Primary KeyLast Name Text 12 char.First Name Text 10 char.SSN Text Text 11 char Input mask as SSNCommRate Number Single, 3

decimalsCommission rate is entered as apercentage, thus 6.5% is enteredas .065

Office Text 4 char. Upper case (> in Format).Validate as SAV or BRU or ATLor GRE or CHA

State Text 2 char. Upper case (> in Format);Default value is GA

CompanyCar Yes/No

There should be a table of customers who are Customers of the salespersons, the CUSTOMER table. It should be made up of the following fields:

Field Data Type Width OtherCustomer ID Auto number Primary Key

Page 13: MS Access 2007

Customer Name Text 15 char.

Customer City Text 12 char.Employee # (this isthe foreign key intothe Customer Table)

Long Integer 5 digits Same as in the SalespersonTable. Common fieldbetween the 2 tables

PART II – STEP BY STEP, CREATING THE SALESPERSON TABLE

1. First open up MS Access. Click in the “Create a New Database” box’s use a “Blank Database” radio button. Then click OK.

2. You’ll be asked to save the new database. Place your diskette in the A drive. Click in the “Save in” box, and click on “3 ½ inch floppy A”. Down below, click in the “File name” box, and call this “Employee.mdb”. Remember – this database will have two tables. Click Create.

3. The blank database will be presented. The “Tables” tab will already be selected for you. Note that you can’t select anything but “New” on the right. Click on it.

4. A new dialog box is opened. Click on Design View, and then OK. You will do this for both tables.

5. Now you’ll start setting up your table. In the Field Name column, give the field its identifying name. You may use the suggested field names above. Then use the Tab key to tab over to the Data Type. When you do, a “drop-down” arrow will be displayed, as well as the default of “Text”.

6. Once you do this, the “General” tab under “Field Properties” below will be selected. It is here that you give the field it’s properties, such as field width, the > sign in Format for the Office and State fields, which makes them uppercase, and you create the Validation Rule and Validation Text, as described in the previous class session.

7. Go ahead and complete all the fields. When you’re done with each table, before you leave Design View, you will need to set up the Primary Key before you go to Datasheet View. Actually, you need to do this before formatting the input mask for the SSN as a Social Security Number)

To do this, place your cursor anywhere on the row containing the field to be designated as the Primary Key.

Now click on the little key icon on the standard tool bar. The Primary Key will be assigned.

8. Now click on the Datasheet view icon. You’ll be prompted to save the table. Call it Salesperson and click OK. After the save is complete, the Datasheet view will be displayed.

9. Now enter in all of your data for the Salesperson Table. Enter about 5 records.

PART III – CREATE THE CUSTOMER TABLE

1. Now that you have created the Salesperson Table, and entered the data, you’re ready to create the Customer Table.

Page 14: MS Access 2007

2. Following Steps 1 through 9 in PART II, create the Customer Table and enter the data, using the same steps for corresponding fields.

3. MAKE SURE THAT THE CUSTOMER RECORDS CONTAIN SALESPERSON ID#s WHICH EXIST IN THE SALESPERSON TABLE.

4. Enter about four records.

PART IV – CREATE THE RELATIONSHIP

1. Exit your table after you’ve entered all the data.2. Click on the Tools drop-down menu from the menu bar. Click on the Relationships

command.3. The Show Table dialog box is displayed:

• Click on each table and then click on Add• Click on the common field in the Salesperson table, and drag it to the same common

field in the Customer table.• When you do, the Relationships dialog box will be displayed. Confirm the fields

displayed – and their tables. Then click in the Enforce Referential Integrity check box.• Click on the Create button. The relationship has been created.

4. X out of “Relationships.” If asked to save it, click "Yes."

PART V – CREATE THE REPORT USING THE REPORT WIZARD

1. Click the “Report” tab. Click New.2. Click the Report Wizard. Then click on the drop-down arrow to choose the table to Report

from. Choose the Salesperson table.3. Click on the fields you wish to report, and then the right arrow, to place the field in the

“Selected Fields” box. To place ALL the fields in the box, click the double-arrow.4. After you’ve done this, if you want to remove a field, click on the field in the “Selected

Fields” box and then the left-pointing single or (to remove all) double-arrow buttons.5. To rearrange the fields, you may have to remove them from the right, and replace them

from the left in different sequences.

* Follow each step in the wizard process to complete your report. At the end of the process, you’ll be prompted to give the report a name. Do that, and click “Finish”. The report will be previewed for you. After previewing it, you may exit the report. If you were to print it, you would click on the Print icon.

PART VI - CREATING QUERIES (simple)

1. Click the “Queries” tab. Click New.2. Click on Design View and click "OK"

Page 15: MS Access 2007

3. From the "Show Table" dialog box, click on the Salesperson Table and click "Add". The table will be added to the view table area above the grid in your query design view. Now click on "Close".

4. In the Query grid, first column, click on the drop-down arrow on the Field row. Choose the Salesperson ID field. Now do the same for each column's field, selecting a Salesperson Table field to display. Don't select all the fields - the idea here is to select only the fields you want.

5. When you've selected your fields, save the query by clicking on the diskette icon and giving your query the name Salesperson Query. Now run the query by clicking on the red exclamation point icon in the toolbar at the top of the screen. Your data will be displayed.

6. Once you've done that, click on the Design View icon in the top left of the toolbar. Experiment by changing your query, and running it each time, in the following ways:

• Click on the Sort row in a column other than the Salesperson ID, and select Ascending. Run the query and view the results. Now change back to Design View and select Descending for the same field and run it. View the results. Try this with several fields.

• Click on the Show button (in Design View) for a field (should be checked - so "uncheck" it) and run the query. That field should not be present. Check the field back again.

• If you haven't chosen the State field to be in your query, click on the next empty field's drop-down arrow and choose it. Now you're going to select, or filter out, records. Click in the Criteria row for the State field and key in =GA. (obviously, you will have to have some employees in GA, and you should have some in other states too) Tab out of the field. Now run the query.

• Try the same selection with Sex being M and then F. You should have some records of each sex so that this filter works, displaying only the male records (and then, the female records)

• You can do the same thing with the Company Car Yes / No field, using it to filter only those Salespersons who drive a company car.

PART VII – JOINED TABLE QUERY

When you create this kind of query, using the same steps (1 through 3 above) you did before, this time add both tables from the Show Table box. The relationship you have previously created will also be in the query. Now you can follow the same steps above, selecting fields from both tables, without even displaying (or using) the Salesperson ID in the query as a field. The connection between the common Salesperson IDs will allow data such as the employee's name and his customer’s city to be displayed.

Page 16: MS Access 2007

Tables

Tables – core database objects; purpose is to store information Field – represented with columns; a specific type of information (e.g. about an

employee: last name, first name) Record – represented with rows; all the information (e.g. about a specific employee:

last name is Ignacio, first name is Lareina) Datasheet View – is a display of data from a table, form, or query in a row-and-column

format; this view allows the user to modify table’s data Field name – is a unique name given to each field in a table, usually an instantly

recognizable name that easily correlates to data it represents Primary Key – is a unique value that identifies each record in a table and ensures only

one record will be created for that particular piece of data Design View – is the display of the design of a table, query, form, or report; this view allows

the user to modify table’s structure Data type – describes the type of data a field or variable can hold, for example the

field Cost can hold a data type of Currency. AutoNumber – an auto-number is a unique number that is automatically

created for each item added to a table Currency - a currency field is comprised of dollar amounts with features such

as dollar signs, commas, decimal points Date/Time – data type contains the date and time values for the years 100

through 9999. This data type can be formatted in various ways, including general, long, short, and medium date/time

Hyperlink – data type is text saved as a link to another document using the other document’s “address” or URL

Lookup wizard – the lookup wizard allows the usage of a value from another table or list by using a list-box or combo box. The data type of the field chosen from the outside table

Memo – a memo data type allows a large amount of text and numbers, such as notes or descriptions, to be use in a field

Page 17: MS Access 2007

Number – a number field can only be comprised of numbers, either positive or negative. Usually, this data type is chosen for data that will be used in a mathematical operation

OLE object – an OLE object is an object from another program ( such as an excel spreadsheet, a Word document, graphics, or sounds ) that are linked or embedded in an Access table

Text – a text data type is a character field that contain at most 225 characters Yes/No – data type used for fields that have an either/or value, such as yes or

no and true or false Description – is simply a detailing of the field, which allows for easier understanding

of the data General Tab:

Field size- the size/type of numbers/characters allowed to be entered into the field. (EX: 255 characters, 100 numbers, etc.) * For number fields

Byte – stores whole numbers from 0 to 255 Integer – stores whole numbers from -32,768 to 32,767 Long Integer – (The default.) Stores whole numbers from -2,147,483,648

to 2,147,483,647 Single – stores negative numbers from -3.402823E38 to -1.401298E-45

and positive numbers from 1.401298E-45 to 3.40282E38

Page 18: MS Access 2007

Double – stores negative numbers from -1.79769313486231E308 to ---------4.94065645841247E-324 and positive numbers from 1.79769313486231E308 to 4.94065645841247E-324

Decimal – stores numbers from -10^28 -1 through 10^28 -1

Format- the layout displayed for the field. (EX: general date, short time, etc) Input Mask- a selection of patterns for data entered into the field. (EX: SSN, zip

code, etc) Caption- the label used on a form to identify the field Default Value- a value that is automatically entered as a default Validation Rule- expression that can precisely define the information that will

be accepted in one or several fields in a record Validation Text- the text message that appears if the validation rule fails Indexed- determines if duplicates are allowed in a field or not Required- is this a required field?

Lookup Tab: Display Control- a drop-down menu from which to decide the control type for a

form. (EX: textbox, drop-down list, list box) Look-up Field – is a field that displays either a field that looks up data from existing tables or

queries or a list that stores a fixed set of values

Page 19: MS Access 2007

Relationships – association between common fields in two tables to link information in one table to information in another table

One-to-one relationship – in which each record in one table can have one and only one related record in the other table

One-to-many relationship – an excellent way to display this is through the use of a form containing a subform; the main, or primary, form displays one record from the “one” side of the one-to-many relationship, and the subform lists all the pertinent records from the “many” side of the relationship

Many-to-many relationship – which are really two one-to-many relationships tied together through a third table

Relationship window –displays the tables and relationships in a database; it is possible to view, create, and modify relationships between tables and queries within this window.

Creating Relationships1. To create a relationship, click TOOLS then RELATIONSHIPS from the toolbar, to activate

the relationships window.2. To view the tables to which you wish to add relationships, click RELATIONSHIPS then

SHOW TABLES from the toolbar.3. At the pop-up window, select the tables you desire to add relationships to and then click

the ADD button.4. Highlight the field you wish to relate to another table by clicking it once.5. Next, drag and drop it to the corresponding field name in the appropriate table.6. A pop-up window will appear titled “Edit Relationship.” This window will clarify what

type of relationship you are creating in the lower right corner of the window.7. Select ENFORCE REFERENTIAL INTEGRITY if you want to ensure that the relationships

you create between tables is valid. The options CASCADE UPDATE and CASCADE DELETE are then available. These options ensure that if a change is made to data in a table that is linked, the changes are reflected in the corresponding linked table.

8. Click CREATE to create the relationship.

Page 20: MS Access 2007

Forms F o r m – a l l o w y o u t o e a s i e r e n t e r , r e t r i e v e , d i s p l a y , e d i t a n d p r i n t r e c o r d s o f t h e u n d e r l y i n g

table Controls – contained in a form; either display information or accept information that

people enter Form View – in which you enter data

Layout View – in which you layout the style of your form

Page 21: MS Access 2007

Design view – in which you work with the elements of the form to refine the way it looks and works

Label controls – containing text that appears in the form in Form view Textbox controls – contain data from the underlying table

Form Properties Bound – when a data in a form is linked to the table it’s based on Record source – the table Control source – the field

Page 22: MS Access 2007

Reports

Report – Summary of data for a professional look and enable sharing and printing Report view – where you can scroll through the information in the report without the page

breaks inserted when it is printed

Page 23: MS Access 2007

Print Preview – in which you see your repot exactly as it will look when printed

Layout view – which displays the data in report but enables you to edit the layout

Design view – in which you can manipulate the design of a report without the page breaks inserted when it is printed

Page 24: MS Access 2007

Queries Queries – are the means of manipulating the data to display in a form or a report. Queries

can sort, calculate, group, filter, join tables, update data, delete data, etc. Their power is immense. The Microsoft Access database query language is SQL (Structured Query Language). The need to know SQL is not required in the early stages of learning Access. Microsoft Access writes the SQL for you, after you tell it what you want, in the Design view of the queries window.

Select query – retrieves data from one or more tables and displays the results in a datasheet; can also be used to group records and calculate sums, counts, averages, and other types of totals

Duplicate query –locates records that have the same information in one or more fields that you specify

Unmatched query – locates records in one table that don’t have related records in another table

Parameter query – prompts you for information to be used in the query – for example, a range of dates

Crosstab query – calculates and restructures data for easier analysis Action query – updates multiple records in one operation; performs an action on the

results of the selection process Delete queries – delete records from one or more tables Update queries – make changes to records in one or more tables Append queries – add records from one or more tables to the end of one or

more other tables Make-table queries – create a new table from all or part of the data in one or

more tables

Creating Queries

1. Click the Create tab.2. In the Other group, click Query Design. The Show

Table window appears (see Figure 1, below).3. On the Tables tab, click tblDemo.4. Click the Add button.5. Click the Close button.

Enter Query’s First Criterion 1. Click in the first Field: cell.2. Click the down arrow button to display the list of field

names (see Figure 2).3. Click the Donation field name.4. Click in the Criteria: row, first cell.5. Type <1 (indicating less than 1).

Page 25: MS Access 2007

6. See Figure 3 for query criteria.

Enter Query’s Second Criterion

1. Click in the second Field: cell.2. Click the down arrow button.3. Click the Last Name field (see Figure 5, below).

Enter Query’s Third Criterion

1. Click in the third Field: cell.2. Click the down arrow button to display the field names menu. 3. Click First Name (see Figure 5).

Run and Save the Query

Page 26: MS Access 2007

1. From the Design tab, in the Results group, click Run (see Figure 7).

2. Click the Save button on the toolbar.3. In the Save As dialog box, enter qryDemo for the name of the query.4. Click OK.5. The query results display (see Figure 8).6. Close or minimize the query.

Page 27: MS Access 2007

Macros and Modules Macro – simple program that performs multiple actions; used to make routine database

actions available as command buttons in forms, which help less experienced users work in your database

Modules – are Microsoft Visual Basic for Applications (VBA) programs; used to carry out tasks that are too complex to be handled with macros