• No se han encontrado resultados

Normativa estatal en relación a los servicios educativos

4.2 INTERPRETACIÓN DE DATOS

4.2.1 CURSO ESCOLAR 2010/

4.2.1.1 Tablas y gráficos de lecto-escritura

In addition to one-to-many relationships, you can create one-to-one relationships and many- to-many relationships, but they are not as common.

In a one-to-one relationship, each record in one table can have one and only one related record in the other table. This type of relationship isn’t commonly used because it is easier to put all the fields in one table. However, you might use two related tables instead of one to break up a table with many fields, or to track information that applies to only some of the records in the first table.

A many-to-many relationship is really two one-to-many relationships tied together through a third table. For example, the GardenCo database contains Products, Orders, and Order Details tables. The Products table has one record for each product sold by The Garden Company, and each product has a unique ProductID. The Orders table has one record for each order placed with The Garden Company, and each record in it has a unique OrderID. However, the Orders table doesn’t specify which products were included in each order; that information is in the Order Details table, which is the table in the middle that ties the other two tables together. Products and Orders each have a one-to-many relationship with Order Details. Products and Orders therefore have a many-to-many relationship with each other. In plain language, this means that every product can appear in many orders, and every order can include many products.

In this exercise, you will first define the relationship between the Categories and Products tables in the GardenCo database. You will then add a subform to a form. For each category displayed in the main form, this subform will display all the products in that category.

USE the GardenCo database in the practice file folder for this topic. This practice file is located in the

My Documents\Microsoft Press\Access 2003 SBS\Forms\Subform folder and can also be accessed by clicking Start/All Programs/Microsoft Press/Access 2003 Step by Step.

OPEN the GardenCo database and acknowledge the safety warning, if necessary.

1

On the Database toolbar, click the Relationships button to open the Relationships Relationships window.

2

If the Show Table dialog box isn’t displayed, on the toolbar, click the Show Table Show Table button. Then double-click Categories and Products in the list displayed. Close the

3

Click CategoryID in one table, and drag it on top of CategoryID in the other table. Access displays the Edit Relationships dialog box, which lists the fields you have chosen to relate and offers several options.

4

Select the Enforce Referential Integrity check box, select the other two check boxes, and then click Create.

Tip

Access uses a system of rules called referential integrity to ensure that relationships between records in related tables are valid, and that you don’t acci­ dentally delete or change related data. When the Cascade Update Related Fields check box is selected, changing a primary key value in the primary table automat­ ically updates the matching value in all related records. When the Cascade Delete Related Records check box is selected, deleting a record in the primary table deletes any related records in the related table.

Toolbox

Control Wizards

Subform/ Subreport

Access draws a line representing the one-to-many relationship between the CategoryID fields in each of the tables.

Tip

You can edit or delete a relationship by right-clicking the line and clicking the appropriate command on the shortcut menu.

5

Close the Relationships window, and click Yes when prompted to save the window’s layout.

6

Open the Categories form in Design view.

7

Enlarge the Form window, and drag the Form Footer section selector down about 1 inch to give yourself some room to work.

8

If the Toolbox isn’t displayed, click the Toolbox button.

9

Make sure the Control Wizards button in the Toolbox is active (orange).

10

Click the Subform/Subreport button, and drag a rectangle in the lower portion of the Details section.

A white object appears in the form, and the first page of the Subform Wizard opens.

Tip

If prompted, follow the instructions to install this wizard.

11

Leave Use existing Tables and Queries selected, and click Next.

13

Add the ProductName, CategoryID, QuantityPerUnit, UnitPrice, and UnitsInStock fields to the Selected Fields list by clicking each one and then clicking the > button.

14

Click Next to display the third page of the wizard.

Because the Category ID field in the subform is related to the Category ID field in the main form, the wizard selects “Show Products for each record in Categories using CategoryID” as the “Choose from a list” option.

Tip

If the wizard can’t figure out which fields are related, it selects the “Define my own” option and displays list boxes in which you can specify the fields to be related.

15

Click Next to accept the default selection, and then click Finish, to accept the default name for the subform and complete the process.

Access displays the Categories form in Design view, with an embedded Products subform. The size and location of the subform is determined by the original rectangle you dragged in the form.

16

Adjust the size and location of the objects in your form as needed to view the entire subform.

17

Notice the layout of the subform in Design view, and then click View to switch to Form view.

The format of the subform has totally changed. In Design view, it looks like a simple form, but in Form view, it looks like a datasheet.

18

Switch back to Design view, make any necessary size adjustments, and if necessary, open the Properties dialog box.

19

Click the Form selector in the upper-left corner of the subform twice. The first click selects the Products subform control, and the second click selects the form. A small black square appears on the selector.

20

On the Format tab of the Properties dialog box, change both Record Selectors and Navigation Buttons to No.

While on this tab, notice the Default View property, which is set to Datasheet. You might want to return to this property and try the other options after finishing this exercise.

21

Close the Properties dialog box, switch back to Form view, and drag the dividers between column headers until you can see all the fields.

Tip

You can quickly adjust the width of columns to fit their data by double-clicking the double arrow between column headings.

22

Click the navigation buttons to scroll through several categories. When you are First Record finished, click the First Record button to return to the first category (Bulbs).

As each category is displayed at the top of the form, the products in that category are listed in the datasheet in the subform.

Next Record

23

Click the category name to the right of the first product.

The arrow at the right end of the box indicates that this is a combo box.

24

Click the arrow to display the list of categories, and change the category to Cacti.

25

Click the Next Record navigation button to move to the next category (Cacti). You can see that the first product is now included in this category.

26

Display the list of categories, and then restore the first product to the Bulbs category.

27

You don’t want people to be able to change a product’s category, so return to Design view. Then in the subform, click the CategoryID text box control, and press A. The CategoryID text box and its label are deleted.

Important

You included the CategoryID field when the wizard created this subform because it is the field that relates the Categories and Products tables. The underlying Products table uses a combo box to display the name of the category instead of its ID number, so that combo box also appears in the subform.

28

Save the form, switch back to Form view, and then adjust the width of the subform columns and the size of the Form window until you can clearly see the fields.

29

Close the Categories form, saving your changes to both the form and the subform. CLOSE the GardenCo database.

1

2

3

4

5

6