Step by step exercise. Editing field properties.


Objective.

 

Practise the field properties with Access2003.

1 If Access is not open, open it to be able to carry out the exercise.

2  Open the Classes.mdb database, found in My Documents in the hard drive.

We are going to modify the structure of the Students table in such a way that each field has the following properties:

Field Properties
Student code

Leave the existing properties.

Student name

Size: 15 and obligatory.

Student surname

Size: 30 and obligatory.

Address

Size: 30 and optional.

City

Size: 15 by default, should appear Los Angeles as the majority of our clients are from this city.

Postcode

Default value: null, should always be 5 numeric digits, always less than 83000 and can be left empty.

Date of Birth

Format: Short date, can be left empty.

Course.

Field size: byte, Default value: null

 

3 Select the Student table by clicking on it so that it stands out.

4 Click on the Design button in the Database window. The Table design window will open.

5 Click on the Student name field to edit its properties.

6 Click on the Field Size property that appears at the lower part of the window, by default the size will remain 50.

7 Type 15.

8 In order for the field to be obligatory we need to put in its Required property the value Yes, for this, position yourself over the Required property and select Yes from the drop down list.

9 As we do not want to modify any other properties in the Student name field, clic in the Student surname field in order to access the properties of this field.

10 TYpe 30 in Field Size.

11 Double click on the No value in the Required property, you will see how it has changed to a Yes. When a property has 2 possible values, by double clicking on the value it changes automatically. This way you have seen 2 different ways to change the Required property, now you choose which you prefer.

12 Click on the Address field and set Field Size to 30. As this field is optional we will leave the Required property as No.

13 Click on the City field and set Field Size to 15.

In order for Los Angeles to appear as the default value we need to change its Default Value property

14 Click on the Default Value property.

15 Type Los Angeles.

16 Click on the Postcode field and delete Default Value 0.

Now we will create an Input Mask.

17 Click on the Input mask property , type 00000 (the 0 represents an obligatory numeric digit so that letters cannot be introduced, and that if a value is introduced it will need to contain 5 digits.

In order for the postal code always to be less than 83000 we need to change the Validation rule property.

18 Click on the Validation rule property and type < 83000.

To improve this validation rule we will fill the Validation text property so that the user knows that the value introduced is incorrect.

19 Click on the Validation text property and type The postal code has to be less than 83000.

This is the message that will appear if the user attempted to introduce a value equal to or more than 83000.

20 Click on the Date of birth field.

21 Click on the Format property.

An arrow will appear to the right, indicating to us the existence of a drop down list.

22 Click on the arrow to the right side.

23 Select the Short date option.

24 Click on the Course field.

25 Click on the Field size property.

An arrow will appear to the right, indicating to us the existence of a drop down list.

26 Click on the arrow to the right side.

27 Select the Byte option.

28 Click on the Default value property.

29 Delete 0 value.

As we have finished with the table's design we will save it.

30 Click on the Save button on the toolbar.

A message appear, answer Yes.

We will now update records in Students table.

1 Click on the Datasheet view button on the toolbar. The Datasheet window will open.

2 Erase all ceros in Course field. If you let one you will have problems creating relationship in Unit 6.

3 Close the Datasheet window.

We will now work with the Courses table. We will begin by editing its structure in such a way that every field has the following properties:

Field Properties
Course code

Size: Byte, as we have less than 255 courses.

Course name Size: 15
Hours Size:Integer
Start date No change
Finish date

No change

 

1 Select the Courses table in such a way that it stands out.

2 Click on the Design button in the Database window.

3 Click on the Course code so as to edit its properties.

4 Click on the Field Size property that appears at the lower part of the window.

An arrow will appear to the right of the property indicating the existence of a drop down menu.

5 Click on Byte option.

6 Set Field Size to 15 in Course name field.

7 Set Hours Field Size to Integer.

8 Click on the Save button on the toolbar to save the table.

9 Click on the button in the Table design window.

10 Close the database by clicking on the Close button in the Database window.

 



   
   
Legal warning: Authorised on-line use only. It is not allowed the use of these courses in companies or private teaching centres.
© aulaClic. All rights reserved. Reproduction in any form whatsoever is prohibited. April-2006.