Presentation is loading. Please wait.

Presentation is loading. Please wait.

CHƯƠNG 3 Finding, Filtering, and Formatting Data.

Similar presentations


Presentation on theme: "CHƯƠNG 3 Finding, Filtering, and Formatting Data."— Presentation transcript:

1 CHƯƠNG 3 Finding, Filtering, and Formatting Data

2 1. Finding and Replacing Information The Find tab of the dialog box The Replace tab of the Find and Replace dialog box

3 1. Finding and Replacing Information To find information: –Start Microsoft Access, open the database, and double-click on the table which contains the information you need to find. –Click the find button on the toolbar, or press ctrl + f –Enter the text you want to search for in the find what text box. Click the find next button. –Repeat step 3 until you find the text you're looking for.

4 1. Finding and Replacing Information To find and replace information: –Open table which contains the information you need to find –Enter the text you want to find for in the find what text box, enter the text you want to replace in the replace with text box. –Click the find next button. –Click the replace button to replace the text. –Repeat steps 3 and 4 if there is more than one occurrence that you want to replace.

5 2. Sorting Records To sort records by one field: –Click anywhere in the column you want to use to sort the list. –Click either the sort ascending button –Or sort descending button on the toolbar.

6 3. Filtering by Selection Filtering a table by selection

7 3. Filtering by Selection Filter Shortcut Menu Commands CommandDescription Filter by Selection Finds and displays all records with the selected value. Filter Excluding Selection Finds and displays all records that don't contain the selected value. Filter For Finds and displays all records that match the text you enter. Remove Filter/Sort Removes the applied filter from the table.

8 3. Filtering by Selection To filter by selection: –Find the field value on which you want to base the filter. –Right-click the field value and select filter by selection from the shortcut menu. Or... –Click the field value, then click the filter by selection button on the toolbar.

9 3. Filtering by Selection To filter excluding the selection: –Right-click the field value you want to exclude and select filter excluding selection from the shortcut menu. To remove a filter: –Right-click the filtered table and select remove filter/sort from the shortcut menu, or –Click the remove filter button on the toolbar.

10 4. Filtering by Form The Filter by Form window

11 4. Filtering by Form Click the filter by form button on the toolbar. Click the empty text box below the field you want to filter, click the drop-down arrow and select the value you want to use to filter the records. Repeat step 2 for each additional field you want to use to specify additional filter criteria. If you want to use or criteria, click the or tab at the bottom of the screen to specify the additional filter criteria. Click the apply filter button on the toolbar.

12 4. Filtering by Form Common Criteria Operators Operator Exampl e Description =="MN"Finds records equal to MN. !=!="MN"Finds records not equal to MN. <<10Finds records less than 10. < =<=10 Finds records less than or equal to 10.

13 4. Filtering by Form >>10 Finds records greater than 10. > =>=10 AND 5 Finds records greater than or equal to 10 and not equal to 5. BETWEE N BETWEEN 1/1/99 AND 12/31/99 Finds records between 1/1/99 AND 12/31/99. LIKELIKE "S*" Finds text beginning with the letter "S." You can use LIKE with wildcards such as *.

14 5. Creating an Advanced Filter To create an advanced filter: –Select records  filter  advanced filter/sort from the menu.

15 5. Creating an Advanced Filter –Double-click each field you want to include from the field list, or drag the field from the field list onto the design grid. –In the design grid, enter any desired search criteria for the field in the criteria row. –Click the sort box list arrow for the field and select a sort order (optional). –Click the apply filter button on the toolbar.

16 5. Creating an Advanced Filter –You can use more than one criterion to sift through records

17 6. Rearranging Columns To move a column: –Open table in datasheet view –Click the field name of the column you want to move. –Drag the selected column to its new location.

18 7. Changing Gridline and Cell Effects To change a datasheet's gridline effects: –Select format datasheet from the menu. –Select the cell effect option you want and click ok.

19 8. Freezing a Field When you can't see important information in the table which doesn’t fit all on the same screen you can freeze a field so it stays in the same place while you scroll around the rest of the table To freeze a column: –Right-click the column field name you want to freeze and select freeze columns from the shortcut menu. To unfreeze a column : –Select format unfreeze all columns from the menu.

20 9. Hiding a Column You can temporarily hide a column when you want to reduce the amount of information that is displayed on the screen To hide a column: –Right-click the column field name you want to hide and select hide columns from the shortcut menu. To unhide a column: –Select format unhide columns from the menu.

21 10. Changing the Datasheet Font Open table in datasheet view Select format  font from the menu

22 1. Understanding Field Properties Open the table in design view:

23 1. Understanding Field Properties Important Field Properties Field Property Description Field Size Text fields: The maximum number of characters (up to 255) that can be entered in the field. The default setting is 50. Number / Currency fields: Stores the number as a Byte, Integer, Long Integer, Single, Double, or Replication ID. The default setting is Long Integer. Format How the data in the field will be displayed on the screen.

24 1. Understanding Field Properties Input Mask Creates a format or pattern in which data must be entered. Decimal Places The number of decimal places in Number and Currency fields. Caption A label for the field that will appear on forms. If you don't enter a caption, Access will use the field name as the caption. Default Value A value that Access enters automatically in the field for new records.

25 1. Understanding Field Properties Validation Rule An expression that limits the values that can be entered in the field. Validation Text The error message that appears when an incorrect or restricted value is entered in a field with a validation rule. Required Specify whether or not a value must be entered in the field. The default is No. Allow Zero Length Specify whether or not the field allows zero- length text strings Indexed Specify whether or not you want to index the field to speed up searches and sorts performed on the field. The default is No.

26 2. Indexing a Field When you index a field, it helps Access find and sort information quicklyespecially in large tables Open the table in design view and then click the field you want to index

27 2. Indexing a Field Click the indexed box. Click the list arrow and select one of the following: –Yes (duplicates ok) if you want to allow multiple records to have the same data in this field. –Yes (no duplicates) if you want to ensure that no two records have the same data in this field.

28 3. Adding a Primary Key to a Table A primary key is a special kind of indexed field that uniquely identifies each record in a table. – A table can have only one primary key –The values in the primary key fields must be unique –Every table you create should have a primary key –The primary key field is automatically indexed

29 3. Adding a Primary Key to a Table –Yes/No, OLE, and hyperlink fields can't be used as the primary key –The primary key is normally a single field, but two or more fields can act together as the primary key –Primary keys are especially important in relationships between tables.

30 3. Adding a Primary Key to a Table To add a primary key to a table: –Display the table in design view, and click the field that you want to set as the primary key.

31 3. Adding a Primary Key to a Table –Click the primary key button on the toolbar, –Or right-click the field you want to use as the primary key and select primary key from the shortcut menu

32 4. Inserting, Deleting, and Reordering Fields To insert a row: –Click the row selector for the field that will be below the new field you want to insert. –Press insert.

33 4. Inserting, Deleting, and Reordering Fields To change the order of fields in a table: –Click the row selector for the field you want to move –Click and drag the selected row to the desired location. To delete a field from a table: –Click the row selector for the field and press delete.

34 5. Using Field Descriptions Descriptions make your database fields easier to fill out and use by providing users with onscreen instructions and help.

35 6. Adding a Caption Captions are useful when you want to provide more detailed headings for your field names

36 7. Changing the Field Size The Field Size property determines the maximum size of information that can be stored in a text or number field To change the field size: –Open the table in design view –Select the field whose size you want to change –Click the field size box in the field properties section. –For text fields: type the field size value. –For number fields: choose the value from the list.

37 7. Changing the Field Size Available Number Field Sizes HeadingNumber Range Decimal Places Storage Size Byte0 to 255None1 byte Integer-32,768 to 32,767None2 bytes Long Integer -2.1x10 38 to 2.1x10 38 None4 bytes

38 7. Changing the Field Size HeadingNumber Range Decimal Places Storage Size Single-3.4x10 38 to 3.4x10 38 74 bytes Double -1.8x10 308 to 1.8x10 308 158 bytes Replication ID N/A 16 bytes

39 8. Formatting Number, Currency, and Date/Time Fields There are two ways to format a number, currency and date/time field: –By selecting a ready-made format from the Format list (the easy way). –By typing a series of formatting characters in the Format box (the hard way).

40 8. Formatting Number, Currency, and Date/Time Fields To format number and currency fields: –Open the table in design view and click the field you want to format. –Click the format box in the field properties section. –Click the list arrow and select a number format.

41 8. Formatting Number, Currency, and Date/Time Fields To change the number of decimal places: –Open the table in design view and then click the field you want to format. –Click the decimal places box in the field properties section. –Click the list arrow and select the number of decimal places you want to display.

42 9. Formatting Text Fields A text field's Format property changes how information appears in the field Open the table in design view and click the text field you want to format. –Click the format box in the field properties section. –Enter the appropriate text formatting symbols.

43 9. Formatting Text Fields General and Text Formatting Symbols CharacterDescriptionTextFormatDisplay ! Aligns text from the right Hello! <LowercaseHello<hello >UppercaseHello>HELLO

44 9. Formatting Text Fields CharacterDescriptionTextFormatDisplay "ABC" Always displays 4&" oz."4 oz. @5558000 @@@- @@@@ 555-8000 *Alert&*! Alert!!!!!!!!! ! [color] Displays value in color Hello[red]Hello

45 10. Setting a Default Value You can enter a default value to specify a value that is automatically entered in a field when a new record is created To enter a default value for a field: –Open the table in design view and click the field you want to add a default value to. –Click the default value box in the field properties section. –Enter the default value you want to appear in the field for new records.

46 11. Requiring Data Entry You can specify that a field must contain data to prevent users from leaving out important information when they are entering data. To require data entry for a field –Open the table in design view and click the field you want to require data entry for. –Click the required box in the field properties section. –Click the list arrow and select yes.

47 12. Validating Data Validating data is the most powerful tool you can use to prevent data-entry errors To validate field data: –Open the table in design view and click the field you want to apply a validation rule to. –Click the validation rule box in the field properties section. –Enter an expression you want to use to validate the field's data

48 12. Validating Data –Click the validation text box in the field properties section. –Type the text that access will display when the user tries to enter incorrect data for the field.

49 13. Creating an Input Mask An Input Mask limits the amount and type of information that can be entered in a field. The only problem with the Input Mask Wizard is that it can only help you create input masks for phone numbers, social security numbers, Zip Codes, and date and time fields. Example: –Input Mask of the phone number: (__ _) __ _ - _____ –if you enter 5555555555 in a Phone field, Access will display (555) 555-5555

50 13. Creating an Input Mask To create an input mask for a field: –Open the table in design view and click the field you want to create an input mask for. –Click the input mask box in the field properties section. –Click the build button to start the input wizard and select an input mask from the predefined list. –Or manually create the input mask by entering the appropriate characters.

51 13. Creating an Input Mask The first step of the Wizard

52 13. Creating an Input Mask Input Mask Characters Characte r Description Characte r Description 0 Numbers 0 to 9 required; plus and minus signs not allowed. & Character or space required. 9 Number or space optional; plus and minus signs not allowed. CCharacter or space optional.

53 13. Creating an Input Mask CharacterDescriptionCharacterDescription #Number or space optional; plus and minus signs not allowed. <Converts the following characters to lowercase.., : ; - / Decimal point, thousands, date, and time separators. > Converts the following characters to uppercase. A Letter or number required. ! Displays characters from right to left, rather than left to right.

54 13. Creating an Input Mask CharacterDescriptionCharacterDescription aLetter or number optional. \ Displays the following input mask character. For example, \* would display *. L Letters A to Z required. Password Displays an asterisk( * ) for each character you type. ? Letter or number optional.

55 14. Creating a Lookup Field Lookup fields are definitely one of the coolest and most powerful features in Access. A lookup field lets you pick a field's entry from a list of values. There are two ways that a lookup field can get its list of values: –From a list of values or options that you enter yourself. –From a list of values in a table or query.

56 14. Creating a Lookup Field Create a lookup list by selecting Lookup Wizard as the field's Data Type.

57 14. Creating a Lookup Field To create a lookup field : –Display the table in design view. –Click the field's data type box, click the list arrow, and select lookup wizard. –Click the i want the lookup column to look up the values in a table or query option and click next. –Select the table or query you want to use for the lookup list and click next.

58 14. Creating a Lookup Field –Select the fields you want to add to the lookup field and click next. –Select a sort order for your list (optional) and click next. –Adjust the width of the columns that will appear in the lookup list and indicate whether or not to include the primary key in the column. Click next. –If prompted, select a column that will act as the bound column and click next. –Enter a label for the lookup column and click finish.

59 15. Creating a Value List Similar to its cousin the lookup list, a value list displays a list of values in a drop-down list A value list displays a list of options that you manually enter.

60 15. Creating a Value List To create a value list: –Display the table in design view. –Click the data type box of the field you want to create the value list for, click the list arrow, and select lookup wizard. –Click the i will type in the values that i want option and click next. Specify the number of columns you want to appear in the value list. –Enter the values in the list. Click next when you're finished. –Enter a label for the lookup column and click finish

61 16. Modifying a Lookup List You can display and modify the properties of a lookup field by clicking the Lookup tab in the Field Properties section.

62 16. Modifying a Lookup List Lookup Field Properties PropertyDescription Display Control Determines whether the lookup field is a text box, combo box, or list box. Row Source Type Determines how Access provides data to the lookup field: from a table or query, from a list of values specified in the Row Source box, or from a list of field names in a table or query. Row Source Determines what is displayed in the lookup field. The Row Source property setting depends on the Row Source Type property setting.

63 16. Modifying a Lookup List PropertyDescription Bound Column The column in the lookup list that contains the value that is actually stored in the field. The bound column is the first column (1) by default. Column Count The number of columns that are displayed in the lookup field list. Column Widths The width of each column that is displayed in the lookup field list. Setting a column width to 0 hides the column. Limit to List Determines whether a field can accept a value that is not in the lookup list.

64 CHƯƠNG 3(tt) Working with Tables and Fields

65 1. Understanding Field Properties Open the table in design view:

66 1. Understanding Field Properties Important Field Properties Field Property Description Field Size Text fields: The maximum number of characters (up to 255) that can be entered in the field. The default setting is 50. Number / Currency fields: Stores the number as a Byte, Integer, Long Integer, Single, Double, or Replication ID. The default setting is Long Integer. Format How the data in the field will be displayed on the screen.

67 1. Understanding Field Properties Input Mask Creates a format or pattern in which data must be entered. Decimal Places The number of decimal places in Number and Currency fields. Caption A label for the field that will appear on forms. If you don't enter a caption, Access will use the field name as the caption. Default Value A value that Access enters automatically in the field for new records.

68 1. Understanding Field Properties Validation Rule An expression that limits the values that can be entered in the field. Validation Text The error message that appears when an incorrect or restricted value is entered in a field with a validation rule. Required Specify whether or not a value must be entered in the field. The default is No. Allow Zero Length Specify whether or not the field allows zero- length text strings Indexed Specify whether or not you want to index the field to speed up searches and sorts performed on the field. The default is No.

69 2. Indexing a Field When you index a field, it helps Access find and sort information quicklyespecially in large tables Open the table in design view and then click the field you want to index

70 2. Indexing a Field Click the indexed box. Click the list arrow and select one of the following: –Yes (duplicates ok) if you want to allow multiple records to have the same data in this field. –Yes (no duplicates) if you want to ensure that no two records have the same data in this field.

71 3. Adding a Primary Key to a Table A primary key is a special kind of indexed field that uniquely identifies each record in a table. – A table can have only one primary key –The values in the primary key fields must be unique –Every table you create should have a primary key –The primary key field is automatically indexed

72 3. Adding a Primary Key to a Table –Yes/No, OLE, and hyperlink fields can't be used as the primary key –The primary key is normally a single field, but two or more fields can act together as the primary key –Primary keys are especially important in relationships between tables.

73 3. Adding a Primary Key to a Table To add a primary key to a table: –Display the table in design view, and click the field that you want to set as the primary key.

74 3. Adding a Primary Key to a Table –Click the primary key button on the toolbar, –Or right-click the field you want to use as the primary key and select primary key from the shortcut menu

75 4. Inserting, Deleting, and Reordering Fields To insert a row: –Click the row selector for the field that will be below the new field you want to insert. –Press insert.

76 4. Inserting, Deleting, and Reordering Fields To change the order of fields in a table: –Click the row selector for the field you want to move –Click and drag the selected row to the desired location. To delete a field from a table: –Click the row selector for the field and press delete.

77 5. Using Field Descriptions Descriptions make your database fields easier to fill out and use by providing users with onscreen instructions and help.

78 6. Adding a Caption Captions are useful when you want to provide more detailed headings for your field names

79 7. Changing the Field Size The Field Size property determines the maximum size of information that can be stored in a text or number field To change the field size: –Open the table in design view –Select the field whose size you want to change –Click the field size box in the field properties section. –For text fields: type the field size value. –For number fields: choose the value from the list.

80 7. Changing the Field Size Available Number Field Sizes HeadingNumber Range Decimal Places Storage Size Byte0 to 255None1 byte Integer-32,768 to 32,767None2 bytes Long Integer -2.1x10 38 to 2.1x10 38 None4 bytes

81 7. Changing the Field Size HeadingNumber Range Decimal Places Storage Size Single -3.4x10 38 to 3.4x10 38 74 bytes Double -1.8x10 308 to 1.8x10 308 158 bytes Replication ID N/A 16 bytes

82 8. Formatting Number, Currency, and Date/Time Fields There are two ways to format a number, currency and date/time field: –By selecting a ready-made format from the Format list (the easy way). –By typing a series of formatting characters in the Format box (the hard way).

83 8. Formatting Number, Currency, and Date/Time Fields To format number and currency fields: –Open the table in design view and click the field you want to format. –Click the format box in the field properties section. –Click the list arrow and select a number format.

84 8. Formatting Number, Currency, and Date/Time Fields To change the number of decimal places: –Open the table in design view and then click the field you want to format. –Click the decimal places box in the field properties section. –Click the list arrow and select the number of decimal places you want to display.

85 9. Formatting Text Fields A text field's Format property changes how information appears in the field Open the table in design view and click the text field you want to format. –Click the format box in the field properties section. –Enter the appropriate text formatting symbols.

86 9. Formatting Text Fields General and Text Formatting Symbols Charact er DescriptionTextFormatDisplay ! Aligns text from the right Hello! <LowercaseHello<hello >UppercaseHello>HELLO

87 9. Formatting Text Fields Charact er Descriptio n TextFormatDisplay "ABC" Always displays 4&" oz."4 oz. @ 555800 0 @@@- @@@@ 555-8000 *Alert&*! Alert!!!!!!!! !! [color] Displays value in color Hello[red]Hello

88 10. Setting a Default Value You can enter a default value to specify a value that is automatically entered in a field when a new record is created To enter a default value for a field: –Open the table in design view and click the field you want to add a default value to. –Click the default value box in the field properties section. –Enter the default value you want to appear in the field for new records.

89 11. Requiring Data Entry You can specify that a field must contain data to prevent users from leaving out important information when they are entering data. To require data entry for a field –Open the table in design view and click the field you want to require data entry for. –Click the required box in the field properties section. –Click the list arrow and select yes.

90 12. Validating Data Validating data is the most powerful tool you can use to prevent data-entry errors To validate field data: –Open the table in design view and click the field you want to apply a validation rule to. –Click the validation rule box in the field properties section. –Enter an expression you want to use to validate the field's data

91 12. Validating Data –Click the validation text box in the field properties section. –Type the text that access will display when the user tries to enter incorrect data for the field.

92 13. Creating an Input Mask An Input Mask limits the amount and type of information that can be entered in a field. The only problem with the Input Mask Wizard is that it can only help you create input masks for phone numbers, social security numbers, Zip Codes, and date and time fields. Example: –Input Mask of the phone number: (__ _) __ _ - _____ –if you enter 5555555555 in a Phone field, Access will display (555) 555-5555

93 13. Creating an Input Mask To create an input mask for a field: –Open the table in design view and click the field you want to create an input mask for. –Click the input mask box in the field properties section. –Click the build button to start the input wizard and select an input mask from the predefined list. –Or manually create the input mask by entering the appropriate characters.

94 13. Creating an Input Mask The first step of the Wizard

95 13. Creating an Input Mask Input Mask Characters Characte r Description Charact er Description 0 Numbers 0 to 9 required; plus and minus signs not allowed. & Character or space required. 9 Number or space optional; plus and minus signs not allowed. CCharacter or space optional.

96 13. Creating an Input Mask CharacterDescriptionCharacterDescription #Number or space optional; plus and minus signs not allowed. <Converts the following characters to lowercase.., : ; - / Decimal point, thousands, date, and time separators. > Converts the following characters to uppercase. A Letter or number required. ! Displays characters from right to left, rather than left to right.

97 13. Creating an Input Mask CharacterDescriptionCharacterDescription aLetter or number optional. \ Displays the following input mask character. For example, \* would display *. L Letters A to Z required. Password Displays an asterisk( * ) for each character you type. ? Letter or number optional.

98 14. Creating a Lookup Field Lookup fields are definitely one of the coolest and most powerful features in Access. A lookup field lets you pick a field's entry from a list of values. There are two ways that a lookup field can get its list of values: –From a list of values or options that you enter yourself. –From a list of values in a table or query.

99 14. Creating a Lookup Field Create a lookup list by selecting Lookup Wizard as the field's Data Type.

100 14. Creating a Lookup Field To create a lookup field : –Display the table in design view. –Click the field's data type box, click the list arrow, and select lookup wizard. –Click the i want the lookup column to look up the values in a table or query option and click next. –Select the table or query you want to use for the lookup list and click next.

101 14. Creating a Lookup Field –Select the fields you want to add to the lookup field and click next. –Select a sort order for your list (optional) and click next. –Adjust the width of the columns that will appear in the lookup list and indicate whether or not to include the primary key in the column. Click next. –If prompted, select a column that will act as the bound column and click next. –Enter a label for the lookup column and click finish.

102 15. Creating a Value List Similar to its cousin the lookup list, a value list displays a list of values in a drop-down list A value list displays a list of options that you manually enter.

103 15. Creating a Value List To create a value list: –Display the table in design view. –Click the data type box of the field you want to create the value list for, click the list arrow, and select lookup wizard. –Click the i will type in the values that i want option and click next. Specify the number of columns you want to appear in the value list. –Enter the values in the list. Click next when you're finished. –Enter a label for the lookup column and click finish

104 16. Modifying a Lookup List You can display and modify the properties of a lookup field by clicking the Lookup tab in the Field Properties section.

105 16. Modifying a Lookup List Lookup Field Properties PropertyDescription Display Control Determines whether the lookup field is a text box, combo box, or list box. Row Source Type Determines how Access provides data to the lookup field: from a table or query, from a list of values specified in the Row Source box, or from a list of field names in a table or query. Row Source Determines what is displayed in the lookup field. The Row Source property setting depends on the Row Source Type property setting.

106 16. Modifying a Lookup List PropertyDescription Bound Column The column in the lookup list that contains the value that is actually stored in the field. The bound column is the first column (1) by default. Column Count The number of columns that are displayed in the lookup field list. Column Widths The width of each column that is displayed in the lookup field list. Setting a column width to 0 hides the column. Limit to List Determines whether a field can accept a value that is not in the lookup list.


Download ppt "CHƯƠNG 3 Finding, Filtering, and Formatting Data."

Similar presentations


Ads by Google