86
COMPREHENSIVE Access Tutorial 5 Creating Advanced Queries and Enhancing Table Design

nota access 2007

Embed Size (px)

DESCRIPTION

access 2007

Citation preview

Page 1: nota access 2007

COMPREHENSIVE

Access Tutorial 5

Creating Advanced Queries and Enhancing

Table Design

Page 2: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 2

Objectives• Review table and object naming standards• Use the Like, In, Not, and & operators in queries• Filter data using an AutoFilter• Use the IIf function to assign a conditional value

to a calculated field in a query• Create a parameter query

Page 3: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 3

Objectives• Use query wizards to create a crosstab query, a

find duplicates query, and a find unmatched query

• Create a top values query• Modify table designs using lookup fields, input

masks, and data validation rules• Identify object dependencies• Review a Memo field’s properties• Designate a trusted folder

Page 4: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 4

Reviewing the Panorama Database

• Figure 5-1 See tables, queries, forms, and reports as database objects on the Navigation Pane

Page 5: nota access 2007

XPReviewing the Panorama Database – Figure 5-1

New Perspectives on Microsoft Office Access 2007 5

Page 6: nota access 2007

XPReview the Field Naming Standards in the tblContract Table• In the Tables group on the Navigation Pane, double-click

the tblContract to open that table in Datasheet view. Notice that each column heading name contains spaces.

• In the Views group of the Home tab, click the View button and display the table in Design view. Note that none of the field names has spaces. These spaces were eliminated in the case that Belmont Landscapes needs to upscale to SQL Server or Oracle, which do not permit spaces in object and field names.

New Perspectives on Microsoft Office Access 2007 6

Page 7: nota access 2007

XPPanorama Database Field Names and Caption Property Settings – Figure 5-2

New Perspectives on Microsoft Office Access 2007 7

Page 8: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 8

Using a Pattern Match in a Query

• A pattern match selects records with a value for the designated field that matches the pattern of the simple condition value

• The Like comparison operator selects records by matching field values to a specific pattern that includes one or more of these wildcard characters: asterisk (*), question mark (?), and number symbol (#)

• Figure 5-4

Page 9: nota access 2007

XPUsing a Pattern Match in a Query – Figure 5-4

New Perspectives on Microsoft Office Access 2007 9

Page 10: nota access 2007

XPUsing a Pattern Match in a Query

• In the Results group on the Query Tools Design tab, click the Run button.

• The query displays 24 records with the area code 616 in the Phone field, as shown in Figure 5-5.

• Note that the hyphens have been removed from the Phone field vales. We will modify the Phone field later in this tutorial.

• Close the qry616AreaCode query.

New Perspectives on Microsoft Office Access 2007 10

Page 11: nota access 2007

XPRecords Displayed by qry616AreaCode Query – Figure 5-5

New Perspectives on Microsoft Office Access 2007 11

Page 12: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 12

Using a List-of-Values Match in a Query

• A list-of-values match selects records whose value for the designated field matches one of two or more simple condition values

• The In comparison operator lets you define a condition with a list of two or more values for a field

Page 13: nota access 2007

XPCreating a Query Using a List-of Values Match• Copy qry616AreaCode by right-clicking it and clicking

Copy on the shortcut menu.• Name the copied query

qryHollandRockfordSaugatuckCustomers in the Query Name text box and then press the Enter key.

• In the Queries group on the Navigation Pane, right-click qryHollandRockfordSaugatuckCustomers to select it and display the shortcut menu.

• Click Design View on the shortcut menu to open the query in Design view and then close the Navigation Pane.

New Perspectives on Microsoft Office Access 2007 13

Page 14: nota access 2007

XPCreating a Query Using a List-of Values Match• Click the Phone Criteria text box, press the F2 key to

highlight the entire condition, and then press the Delete key to remove the condition.

• Right-click the City Criteria text box to open the shortcut menu, click Zoom to open the Zoom dialog box, and then type In(“Holland”,”Rockford”,”Saugatuck”).

• Click the OK button to close the Zoom dialog box, and then save and run the query. Access displays 13 records with Holland, Rockford, and Saugatuck in the City field.

• Close the query.

New Perspectives on Microsoft Office Access 2007 14

Page 15: nota access 2007

XPRecord Selection Based on Matching Field Values to a List of Values – Figure 5-6

New Perspectives on Microsoft Office Access 2007 15

Page 16: nota access 2007

XPCompleted qryHollandRockfordSaugatuck Customers in Design View

New Perspectives on Microsoft Office Access 2007 16

Page 17: nota access 2007

XPCompleted qryHollandRockfordSaugatuck Customers in Datasheet View

New Perspectives on Microsoft Office Access 2007 17

Page 18: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 18

Using the Not Operator in a Query• The Not logical operator negates a criterion or

selects records for which the designated field does not match the criterion

Page 19: nota access 2007

XPCreating a Query Using the Not Logical Operator• Right-click qryHollandRockfordSaugatuckCustomers and

then click Rename on the shortcut menu.• Enter Non between qry and Holland in the query’s name.• Open the query

qryNonHollandRockfordSaugatuckCustomers.• Click the City Criteria text box, open the Zoom dialog box,

click at the beginning of the expression, type Not, and then press the spacebar, as shown in Figure 5-7.

• Click the OK button and then save and run the query. Access displays 29 customer records where the City field value is not Holland, Rockford, or Saugatuck.

• Close the query.New Perspectives on Microsoft Office Access 2007 19

Page 20: nota access 2007

XPCreating a Query Using the Not Logical Operator – Figure 5-7

New Perspectives on Microsoft Office Access 2007 20

Page 21: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 21

Using an AutoFilter to Filter Data• Open the qrySmallContractsOrWinterSignings query in

Design view.• Run the query and then click the arrow on the City

column heading to display the AutoFilter menu, as shown in Figure 5-8.

• Click the (Select All) check box to deselect all check boxes, click the East Grand Rapids check box, and then click the Grand Rapids check box, as shown on the second slide.

• Click the OK button. Access displays four records, as shown in Figure 5-9.

Page 22: nota access 2007

XPUsing an AutoFilter to Filter Data in a Query Dataset

New Perspectives on Microsoft Office Access 2007 22

Page 23: nota access 2007

XPUsing an AutoFilter to Filter Data in a Query Dataset

New Perspectives on Microsoft Office Access 2007 23

Page 24: nota access 2007

XPUsing an AutoFilter to Filter Data in a Query Dataset

New Perspectives on Microsoft Office Access 2007 24

Page 25: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 25

Assigning a Conditional Value to a Calculated Field• The & (ampersand) operator is a concatenation operator

that joins text expressions• The IIf (Immediate If) function assigns one value to a

calculated field or control if a condition is true, and a second value if the condition is false

• The IsNull function tests a field value or an expression for a null value; if the field value or expression is null, the result is true; otherwise, the result is false

Page 26: nota access 2007

XPAssigning a Conditional Value to a Calculated Field• Click the Create tab on the Ribbon and then in the Other

group on the Create tab, click the Query Design button to open the Show Table dialog box on top of the Query Window in Design view.

• Open the tblCustomer in the Table list box, click the Add button, and then Close the Show Table dialog box.

• Double-click the title bar of the tblCustomer field list to highlight all records and then drag the highlighted fields to second column’s Field text box.

• Right-click the first column’s Field text box and then click Build in the shortcut menu to open the Expression Builder dialog box.

New Perspectives on Microsoft Office Access 2007 26

Page 27: nota access 2007

XPAssigning a Conditional Value to a Calculated Field• Type Customer: and then press the spacebar. • Double-click Functions in the left column, click Built-In

Functions in the left column, scroll down the middle column and click Program Flow, click IIF in the right column, and then click the Paste button, as shown in Figure 5-10.

• Click the first <<Expr>> and then press the Delete key.• Click the <<expr>> in the expression box, click

Inspection in the middle column, click IsNull in the right column, click the Paste button, click <<varexpr>> in the expression box, and then type Company.

New Perspectives on Microsoft Office Access 2007 27

Page 28: nota access 2007

XPAssigning a Conditional Value to a Calculated Field

New Perspectives on Microsoft Office Access 2007 28

Page 29: nota access 2007

XPAssigning a Conditional Value to a Calculated Field• Click <<falsepart>> and then type Company to replace

it.• Click <<truepart>> and then type

LastName & “, “ & FirstName to replace it, as shown in Figure 5-12.

• Click the right side of the Customer Sort text box and then click Ascending.

• In the Show/Hide group on the Query Tools Design tab, click the Property Sheet button. The property sheet opens and displays properties for the calculated field, as shown in Figure 5-13.

New Perspectives on Microsoft Office Access 2007 29

Page 30: nota access 2007

XPAssigning a Conditional Value to a Calculated Field – Figure 5-12

New Perspectives on Microsoft Office Access 2007 30

Page 31: nota access 2007

XPAssigning a Conditional Value to a Calculated Field – Figure 5-13

New Perspectives on Microsoft Office Access 2007 31

Page 32: nota access 2007

XPAssigning a Conditional Value to a Calculated Field• Save the query as qryCustomersByName.• Run the query and then resize all columns to

best fit, as shown in Figure 5-14.• Save the query and then close it.

New Perspectives on Microsoft Office Access 2007 32

Page 33: nota access 2007

XPAssigning a Conditional Value to a Calculated Field – Figure 5-14

New Perspectives on Microsoft Office Access 2007 33

Page 34: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 34

Creating a Parameter Query

• A parameter query displays a dialog box that prompts the user to enter one or more criteria values when the query is run

• Create a select query that includes all fields to appear in the query results. Also choose the sort fields and set the criteria that do not change when you run the query

• Decide which fields to use as prompts when the query runs. In the Criteria text box for each of these fields, type the prompt you want to appear in a message box when you run the query, and enclose the prompt in brackets

Page 35: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 35

Creating a Parameter Query

• Copy and paste the qryCustomersByName query and name it qryCustomersByNameParameter.

• Open the qryCustomersByNameParameter in Design view and then close the Navigation Pane.

• Click the City Criteria text box, type [Enter the city:], and then press the Enter key, as shown in Figure 5-15.

• Save and run the query. Access displays a dialog box prompting the user for the name of the city, as shown in Figure 5-16.

Page 36: nota access 2007

XPCreating a Parameter Query

New Perspectives on Microsoft Office Access 2007 36

Page 37: nota access 2007

XPCreating a Parameter Query

New Perspectives on Microsoft Office Access 2007 37

Page 38: nota access 2007

XPCreating a Parameter Query

New Perspectives on Microsoft Office Access 2007 38

Page 39: nota access 2007

XPCreating a More Flexible Parameter Query

• Switch the qryCustomersByName Parameter query to Design view.

• Click the City Criteria text box and then open the Zoom dialog box.

• Click to the left end of the expression in the Zoom dialog box, type Like, press the spacebar, go to the right end of the expression, and then type & “*”, as shown in Figure 5-18.

• Click the OK button, save your query design changes, and then run the query.

• Close the query after running it.New Perspectives on Microsoft Office Access 2007 39

Page 40: nota access 2007

XPCreating a More Flexible Parameter Query

New Perspectives on Microsoft Office Access 2007 40

Page 41: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 41

Creating a Crosstab Query

• A crosstab query performs aggregate function calculations on the values of one database field and displays the results in a spreadsheet format

• Aggregate Function DefinitionAvg Average of field valuesCount Number of nonnull valuesFirst First field valueLast Last field valueMax Highest field valueMin Lowest field valueStDev Standard deviation of field valuesSum Total of the field valuesVar Variance of the field values

Page 42: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 42

Creating a Crosstab Query

• In the Other group on the Create tab, click the Query Wizard button.

• In the New Query dialog box, click Crosstab Query Wizard, and then click the OK button.

• In theWizard dialog boxes, select the table or query (qryCustomersAndInvoices) on which to base the crosstab query, and then click the Next button.

• Move the City field to the Selected Fields list box to select it as the row heading field, and then click the Next button.

Page 43: nota access 2007

XPCreating a Crosstab Query

• Select the InvoicePaid field as the column heading field, and then click the Next button.

• Select InvoiceAmt in the Fields list box, click Sum in the Functions list box, make sure that the Yes, include row sums check box is checked, and then click the Next button.

• Enter qryCustomersAndInvoicesCrosstab as the query’s name, make sure that the option button for viewing the query is selected, and then click the Finish button. Access then saves the query and displays the recordset.

• Resize all the columns in the query recordset to their best fit, and then click the City field value in the first row (Battle Creek). See Figure 5-23 on the next slide.

New Perspectives on Microsoft Office Access 2007 43

Page 44: nota access 2007

XPCrosstab Query Recordset – Figure 5-23

New Perspectives on Microsoft Office Access 2007 44

Page 45: nota access 2007

XPCrosstab Query in Design View – Figure 5-24

New Perspectives on Microsoft Office Access 2007 45

Page 46: nota access 2007

XPChanging the Crosstab Query’s Column Headings

• Click the Home tab on the Ribbon, click View, and then change to Design view, as shown in Figure 5-24.

• Click the InvoicePaid Field text box (in the second column), and then open the Zoom dialog box.

• Delete the highlighted expression, and then type IIf(InvoicePaid,”Paid”,”Unpaid”) in the Zoom dialog box.

New Perspectives on Microsoft Office Access 2007 46

Page 47: nota access 2007

XPChanging the Crosstab Query’s Column Headings

• Click the OK button, and then save and run the query. Access displays the crosstab query with Paid and Unpaid, as shown in the next slide.

• Close the query.

New Perspectives on Microsoft Office Access 2007 47

Page 48: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 48

ChangedCrosstab Query’s Column Headings

Page 49: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 49

Creating a Find Duplicates Query

• A find duplicates query is a select query that finds duplicate records in a table or query.

• In the Other group on the Create tab, click the Query Wizard button.

• Click Find Duplicates Query Wizard, and then click the OK button.

• In the first Find Duplicates dialog box, click the Table: tblContract (if necessary) and then click OK.

• Move the StartDate field to the Selected Fields list box, and then click the Next button.

• Click the >> button to move the remaining fields to the Selected fields list box, and then click the Next button.

Page 50: nota access 2007

XPCreating a Find Duplicates Query

• Enter qryDuplicateContractStartDates as the name of the query in the final Find Duplicates dialog box, be sure the option button for viewing the results is selected, and then click the Finish button.

• Access saves the query and then displays 10 records for contracts with duplicate start dates, as shown in Figure 5-26.

• Close the query.

New Perspectives on Microsoft Office Access 2007 50

Page 51: nota access 2007

XPCreating a Find Duplicates Query

New Perspectives on Microsoft Office Access 2007 51

Page 52: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 52

Creating a Find Unmatched Query

• A find unmatched query is a select query that finds all records in a table or query that have no related records in a second table or query.

• In the Other group on the Create tab, click the Query Wizard button.

• Click Find Unmatched Query Wizard, and then click the OK button.

• Click the Queries button in the first Find Unmatched Query Wizard dialog box, scroll down the list of queries and then click the qryCustomersByName query to select it.

• In the next dialog box, click Table: tblContract in the list box (if necessary) and then click the Next button.

Page 53: nota access 2007

XPCreating a Find Unmatched Query

• The CustomerID field is the common field between the table and the query. Click CustomerID in the Fields in ‘qryCustomersByName’ list box, click CustomerID in the Fields ‘tblContract’ list box, and then click the button to join the two fields. The Matching fields box will then display CustomerID CustomerID to indicate the joining of the two fields.

• Click the Next button to open the next dialog box.• In the next dialog box, click the >> button to move all

fields to the Selected Fields list box, and then click the Next button to open the final dialog box.

New Perspectives on Microsoft Office Access 2007 53

Page 54: nota access 2007

XPCreating a Find Unmatched Query

• In the final dialog box, type qryInactiveCustomers as the query’s name, be sure the option button for viewing the results is selected, and then click the Finish button.

• Access saves the query and then displays two records in the query recordset, as shown in Figure 5-28.

• Resize the columns, save the query again, and then close the query

New Perspectives on Microsoft Office Access 2007 54

Page 55: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 55

Creating a Find Unmatched Query

Page 56: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 56

Creating a Top Values Query

• The Top Values property for a query lets you limit the number of records in the query results

• Create or open a select query with the necessary fields and sorting and selection criteria

• Open the Navigation Pane, open the qryLargeContractAmounts query in Datasheet view, and then close the Navigation Pane.

• Click the Home tab and then switch to Design view.• In the Query Setup Group on the Query Tools Design tab,

click the Return arrow (with the Screen Tip “Top Values”, and then click 25%, as shown in Figure 5-29.

Page 57: nota access 2007

XPCreating a Top Values Query

New Perspectives on Microsoft Office Access 2007 57

Page 58: nota access 2007

XPCreating a Top Values Query

• Run the query. Access displays six records in the query recordset. These records represent the customers with the highest 25% contract amounts, as shown in Figure 5-30.

• Because this query is not needed, don’t save it. Thus, close the query without saving it.

New Perspectives on Microsoft Office Access 2007 58

Page 59: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 59

Creating a Top Values Query

Page 60: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 60

Creating a Lookup Field

• A lookup field lets the user select a value from a list of possible values

• You use a Lookup Wizard field in Access to create a lookup field in a table

• Figures 5-32 and 5-33

Page 61: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 61

Creating a Lookup Field

• Click on Relationships in the Show/Hide group of the Database Tools tab and delete the relationship between the tblContract and tblCustomer.

• Open tblContract in Design view.• Click the right side of the Data Type text box for the

CustomerID field and then click Lookup Wizard.• Make sure that the option for looking up values in a

table or query is selected and then click the Next button to display the next dialog box.

Page 62: nota access 2007

XPCreating a Lookup Field

• Click the Queries option button in the View section to display the list of queries, scroll to and click Query: qryCustomersByName, and then click the Next button.

• In the next dialog box, click Customer (if necessary) and move it to the Selected Fields list box, click CustomerID (if necessary) and move it to the Selected Fields list box, and then click the Next button.

• Click the arrow at the right end of the 1 text box, click Customer, and then click the Next button.

• Resize the two columns to best fit and then click the Next button.

New Perspectives on Microsoft Office Access 2007 62

Page 63: nota access 2007

XPCreating a Lookup Field

• Click CustomerID in the Available Fields list box and then click the Next button to open the final dialog box.

• Accept CustomerID as the table name and then click the Finish button.

• Save the tblContract table and switch to Datasheet view.

• For ContractNum 3030, click Lily’s Boutique in the CustomerID column, and then click the arrow at the right-side to display the list of Customer and CustomerID field values from the qryCustomersByName query.

New Perspectives on Microsoft Office Access 2007 63

Page 64: nota access 2007

XPCreating a Lookup Field

• Scroll up the list box and then click Ingram, Michael to display in the datasheet and to store a CustomerID field value of 11042 in the table, as shown in the next slide.

• Save and close the tblContract table.

New Perspectives on Microsoft Office Access 2007 64

Page 65: nota access 2007

XPCreated Lookup Field

New Perspectives on Microsoft Office Access 2007 65

Page 66: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 66

Using the Input Mask Wizard

• A literal display character is a special character that automatically appears in specific positions of a field value; users don’t need to type literal display charactersInput mask

• To use the Input Mask Wizard for the Phone field.• Open tblCustomer in Design view, click the Phone Field

Name text box to make that row the current row and to display its Field Properties options.

• Click the Input Mask text box in the Field Properties pane. A Build button … appears to the right of the Input Mask text box.

Page 67: nota access 2007

XPUsing the Input Mask Wizard

• Click the Build button … at the right side of the Input Mast text box. The first Input Mask Wizard dialog box opens.

• If necessary, click Phone Number in the Input Mask list box to select it, and then click the Next button.

• In the next dialog box, accept all wizard defaults and then click the Next button to open the final dialog box.

• In the final dialog box, make sure that the option without the symbols in the mask is selected and then click the Finish button. Access displays the tblCustomer table in Design view, as shown in Figure 5-36.

• Change the Phone field size from 14 to 10.

New Perspectives on Microsoft Office Access 2007 67

Page 68: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 68

Using the Input Mask Wizard

Page 69: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 69

Defining Data Validation Rules

• To prevent a user from entering an incorrect value in the Zip field, you can create a field validation rule

• The Validation Rule property value specifies the valid values that users can enter in a field

• The Validation Text property value will be displayed in a dialog box if the user enters an invalid value

• A table validation rule compares one field value in a table record to another field value in the same record to verify their relative accuracy

Page 70: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 70

Defining Data Validation Rules

• Switch to Design view for the tblCustomer table, and then click the Zip Field Name text box to make that row the current row.

• Since the Zip field is a number field, you will specify a range of valid values in the Validation Rule text box.

• In the Field Properties pane, click the Validation Rule text box, type >=48000 And <=49999, and then press the Tab key.

• Type Michigan zip codes must be between 48000 and 49999 in the Validation Text text box, as shown in Figure 5-41

Page 71: nota access 2007

XPDefining Data Validation Rules – Figure 5-41

New Perspectives on Microsoft Office Access 2007 71

Page 72: nota access 2007

XPDefining Data Validation Rules

• Save the table.• Switch to Datasheet view, and then scroll the table to the

right until the Zip field is visible.• Double-click the 49341 in the first row’s Zip field text box,

type 54321, and then press the Tab key. A dialog box opens containing the message “Michigan zip codes must be between 48000 and 49999,” which is the Validation Text property setting you created, as shown in the next slide.

• Click the OK button, and then press the Esc key. The first row’s Zip field value again has its original value, 49341.

• Close the tblCustomer table.

New Perspectives on Microsoft Office Access 2007 72

Page 73: nota access 2007

XPDefining Data Validation Rules

New Perspectives on Microsoft Office Access 2007 73

Page 74: nota access 2007

XPDefining Table Validation Rules

• Open the tblContract table in Design view, and then, in the Show/Hide group of the Database Tools Design tab, click the Property Sheet button to open the property sheet for the table.

• In the property sheet, click the Validation Rule text box, type [SigningDate]<[StartDate], and then press the Tab key.

• Type The signing date must be earlier than the start date in the Validation text box, as shown in Figure 5-42.

New Perspectives on Microsoft Office Access 2007 74

Page 75: nota access 2007

XPDefining Table Validation Rules – Figure 5-42

New Perspectives on Microsoft Office Access 2007 75

Page 76: nota access 2007

XPDefining Table Validation Rules

• Close the property sheet, save the table, and switch to Datasheet view.

• Click the Signing Date column value in the first records, click the date picker icon to the right of the date, click 27 in the calendar control to change the date to 2/27/2010, press the Tab key two times to complete the changes to the record. A dialog box opens containing the message “The signing date must be earlier than the start date,” as shown in the next slide.

• Unlike field validation rule violations, which Access detects immediately after you finish your entry and advance to another field, Access detects table validation rule violations when you finish all changes the current record and advance to another record.

New Perspectives on Microsoft Office Access 2007 76

Page 77: nota access 2007

XPDefining Table Validation Rules

New Perspectives on Microsoft Office Access 2007 77

Page 78: nota access 2007

XPDefining Table Validation Rules

• Click the OK button, and then press the Esc key to undo your change to the Signing Date column value.

• Close the tblContract table.

New Perspectives on Microsoft Office Access 2007 78

Page 79: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 79

Working with Memo Fields

• You use a Memo field for long comments and explanations.• Text fields are limited to 255 characters, but Memo fields can hold

up to 65,535 characters.• Open the tblCustomer table in Datasheet view.• Click the Company column selector, press and hold down the Shift

key, click the Last Name column selector, and then release the Shift key to select the Company, First Name, and Last Name columns.

• In the Records group on the Home tab, click the More button, and then click Freeze. The three columns shift to the left and are now the three leftmost columns in the datasheet. Scroll to the right until the entire Comments column can be seen, as shown in Figure 5-43.

Page 80: nota access 2007

XPWorking with Memo Fields – Figure 5-43

New Perspectives on Microsoft Office Access 2007 80

Page 81: nota access 2007

XPWorking with Memo Fields

• The Comments field values are partially hidden because the column is not wide enough. Thus, you will view the Comments field value in the Zoom dialog box.

• Click the Comments text box for the first record, hold down the Shift key, press the F2 key, and then release the Shift key. A Zoom dialog box displays the entire Comments field value for the first record, as shown in the next slide.

• Click the OK button to close the Zoom dialog box.

New Perspectives on Microsoft Office Access 2007 81

Page 82: nota access 2007

XPViewing the Property Settings of the Memo Field• Save the Customer table, switch to Design view, click the

Comments Field Name text box to make that row the current row, and then scroll to the bottom of the list of properties in the Field Properties pane.

• Click the Text Form text box in the Field Properties pane, and then click its arrow. The list of available text formats appears in the list box, as shown in Figure 5-44.

• The Text Format property was set to Rich Text, which lets your format the datasheet field contents using the options in the Font group of the Home tab. The default Text Format property setting for a Memo field is plain text, which doesn’t allow formatting

New Perspectives on Microsoft Office Access 2007 82

Page 83: nota access 2007

XPViewing the Property Settings of the Memo Field – Figure 5-44

New Perspectives on Microsoft Office Access 2007 83

Page 84: nota access 2007

XPViewing the Property Settings of the Memo Field• Click the arrow on the Text Format text box to close the list, scroll

down the Field Properties pane to the bottom of the list of properties, and then click the Append Only text box, as shown in the next slide.

• The Append Only property, which appears at the bottom of the list of properties, tracks the changes that you make to a Memo field. The default setting of No lets you edit the Memo field value in a normal way. Setting this property to Yes also lets you edit the Memo field value in a normal way, but additionally, causes Access to keep a historical record of all versions of the Memo field value. You can view each version of the field value, along with a date and time stamp of when each version change occurred.

• The review of the Memo field is now finished, thus close the tblCustomer table.

New Perspectives on Microsoft Office Access 2007 84

Page 85: nota access 2007

XPViewing the Property Settings of the Memo Field

New Perspectives on Microsoft Office Access 2007 85

Page 86: nota access 2007

XP

New Perspectives on Microsoft Office Access 2007 86

Closing the Panaroma Database

• Click the Office Button, click on Manage, and then click Compact and Repair Database.

• Click the Office Button again and Close the Panorama database.