51
Access Form Design Access Form Design Technical Support Technical Support Services Services

38822345 MS Access Form Design

Embed Size (px)

DESCRIPTION

Access Form Design this will keep your understading in generatin MS form.Just follow the Instruction as Described

Citation preview

Page 1: 38822345 MS Access Form Design

Access Form Design Access Form Design

Technical Support ServicesTechnical Support Services

Course DescriptionCourse Description This is the fifth in a series of six workshops about Microsoft Access It deals This is the fifth in a series of six workshops about Microsoft Access It deals

specifically with form design specifically with form design The purpose of this installment is to expose you to the possibilities involved in The purpose of this installment is to expose you to the possibilities involved in

designing your database forms Form design is time consuming and requires some designing your database forms Form design is time consuming and requires some patience Learning the form design process is a considerable portion of the database patience Learning the form design process is a considerable portion of the database development process development process

Our goal is to assist you to learn the software understand some basic concepts and Our goal is to assist you to learn the software understand some basic concepts and show you some tips and techniques so you can develop your database show you some tips and techniques so you can develop your database managementprogramming skills over time managementprogramming skills over time

The six workshops are The six workshops are bull bull Introduction to Access Introduction to Access bull bull Access Queries Access Queries bull bull Access Reports Access Reports bull bull Access Database Design Access Database Design bull bull Access Form Design Access Form Design bull bull Access Macros Access Macros

Form BasicsForm Basics

Uses of Forms Uses of Forms Forms created in Microsoft Access are very much like Forms created in Microsoft Access are very much like

paper forms except they have a wider variety of paper forms except they have a wider variety of functions and uses They can be used to functions and uses They can be used to

bull bull Enter data into the database Enter data into the database Using a form for data entry not only saves time it is a Using a form for data entry not only saves time it is a

way to prevent errors Values can be selected from way to prevent errors Values can be selected from pull down lists thereby reducing the typing time and pull down lists thereby reducing the typing time and insuring that data entry rules are consistent insuring that data entry rules are consistent

bull bull View or browse data in the database View or browse data in the database A form can be used to view or browse through the data A form can be used to view or browse through the data

from a single record in form view or multiple records from a single record in form view or multiple records in tabular or datasheet view in tabular or datasheet view

bull bull Replicate source documents Replicate source documents An Access form can be created that looks exactly like the paper source An Access form can be created that looks exactly like the paper source

document or data collection form During data entry the user doesnt document or data collection form During data entry the user doesnt have to be concerned with finding the exact spot in the table to insert have to be concerned with finding the exact spot in the table to insert the data the form and its table links will position it in the correct table the data the form and its table links will position it in the correct table field field

bull bull Provide an attractive presentation of data Provide an attractive presentation of data The form can be designed to use a variety of fonts colors and special The form can be designed to use a variety of fonts colors and special

effects such as shading to enhance its appearance effects such as shading to enhance its appearance bull bull Calculate totals Calculate totals The form can extract raw numbers from a table record calculate totals or The form can extract raw numbers from a table record calculate totals or

evaluate mathematical expressions and display the results as a part of evaluate mathematical expressions and display the results as a part of the form bull the form bull Hold a chart or pivot table Hold a chart or pivot table

A form can be used to display data in a graphical format (such as a bar A form can be used to display data in a graphical format (such as a bar chart or a pie chart) or in a Microsoft Excel pivot table format These chart or a pie chart) or in a Microsoft Excel pivot table format These forms can only be used to display data they cannot be used for data forms can only be used to display data they cannot be used for data entry entry

bull bull Display data from more than one table Display data from more than one table The form can be based on a multiple table query instead of a single table The form can be based on a multiple table query instead of a single table

Using this feature you can access the data in several tables Using this feature you can access the data in several tables simultaneously simultaneously

Form ObjectsForm Objects All of the information on a form is contained in controls Controls are objects on a All of the information on a form is contained in controls Controls are objects on a

form that are used to display data perform actions or decorate the form form that are used to display data perform actions or decorate the form bull bull Some controls are Some controls are bound bound (linked) to fields in a table or a query These controls can (linked) to fields in a table or a query These controls can

place data into the fields or display data from the fields place data into the fields or display data from the fields bull bull Different types of controls or objects are used to display different data types a Different types of controls or objects are used to display different data types a text text

box box is used to display data and numbers an is used to display data and numbers an object box object box is used to display pictures is used to display pictures and other controls display information that is part of the form design and other controls display information that is part of the form design

bull bull Labels Labels are controls that are used to display descriptive text while are controls that are used to display descriptive text while lines lines and and squares squares are controls that are used to organize or separate data are controls that are used to organize or separate data

bull bull The The image image control is used to enhance the appearance of the form with a logo clip art control is used to enhance the appearance of the form with a logo clip art or some other graphic file If you want each database record to have a different or some other graphic file If you want each database record to have a different image (eg employee photographs) then use a bound object control instead image (eg employee photographs) then use a bound object control instead

bull bull Calculated controls Calculated controls act like bound controls but are used to display the results of a act like bound controls but are used to display the results of a calculation Frequently the parameters used in the underlying formula are other calculation Frequently the parameters used in the underlying formula are other controls on the form controls on the form

Creation MethodsCreation Methods

Access contains several ways to create a form You can design the form Access contains several ways to create a form You can design the form yourself by placing controls on a blank grid or you can use one of the yourself by placing controls on a blank grid or you can use one of the built-in Wizards The most common approach is to use a wizard to develop built-in Wizards The most common approach is to use a wizard to develop the basic design of the form (a rough draft) and then switch to the design the basic design of the form (a rough draft) and then switch to the design view for form customization view for form customization

bull bull Build From Scratch Build From Scratch You as the user can enter controls labels and links to the data in the You as the user can enter controls labels and links to the data in the

underlying tables in the design view of a form underlying tables in the design view of a form bull bull Autoform Wizards Autoform Wizards

Each of the autoform wizards produces a simple preformatted form in Each of the autoform wizards produces a simple preformatted form in either columnar tabular or datasheet format Each wizard works either columnar tabular or datasheet format Each wizard works automatically without prompting from the userautomatically without prompting from the user

bull bull Other Wizards Other Wizards Other form wizards are available that will produce columnar tabular Other form wizards are available that will produce columnar tabular datasheet justified chart or pivot table forms Each wizard prompts the datasheet justified chart or pivot table forms Each wizard prompts the user with a series of questions and bases the form on the answersuser with a series of questions and bases the form on the answers

Sources of DataSources of Data

When a form is used to enter update or display When a form is used to enter update or display data from a single table then you can connect data from a single table then you can connect or link the form directly to the table However or link the form directly to the table However if the form is to use data from multiple tables if the form is to use data from multiple tables then the tables should be linked together in a then the tables should be linked together in a query and the form based on the query query and the form based on the query

Microsoft Access forms are generally classified into one of these typesMicrosoft Access forms are generally classified into one of these types Columnar Columnar In a columnar form the values are all placed in one vertical In a columnar form the values are all placed in one vertical

column one item to a line and one record per form Access will place the column one item to a line and one record per form Access will place the data in newspaper style columns if the number of data items exceeds the data in newspaper style columns if the number of data items exceeds the form length form length

Tabular Tabular In a tabular form the data is placed in rows with field labels at In a tabular form the data is placed in rows with field labels at the top Multiple records can be displayed on a single form Tabular forms the top Multiple records can be displayed on a single form Tabular forms are best when you want to display multiple records with relatively few are best when you want to display multiple records with relatively few fields to prevent the need for left to right scrollingfields to prevent the need for left to right scrolling

Datasheet Datasheet A datasheet form will display multiple records in a typical A datasheet form will display multiple records in a typical datasheet view or single records in a tabular view This form is used datasheet view or single records in a tabular view This form is used mainly as a subform mainly as a subform

Justified Justified Available through the Form Wizard lays out fields in a staggered Available through the Form Wizard lays out fields in a staggered compact manner compact manner

MainSubformMainSubform A A mainsubformmainsubform form is used to show a one to many form is used to show a one to many

relationship between the main form and the subform The relationship between the main form and the subform The main (or one side) is displayed in single column format on the main (or one side) is displayed in single column format on the top of the form while the subform (or many side) is displayed top of the form while the subform (or many side) is displayed in a datasheet format on the bottom of the form The subform in a datasheet format on the bottom of the form The subform can be used to display one or more records that are related to can be used to display one or more records that are related to the main form There is a subform wizard button available in the main form There is a subform wizard button available in the Form Design Toolbox the Form Design Toolbox

minus minus Linked Forms Linked Forms The main form in a linked form set contains a button that branches to or The main form in a linked form set contains a button that branches to or

opens another form related to the first The second form is displayed in its opens another form related to the first The second form is displayed in its own window generally on top of the first form Closing the second form own window generally on top of the first form Closing the second form returns control to the main form returns control to the main form

ChartsCharts

The chart form displays data as a graph such as a The chart form displays data as a graph such as a bar chart pie chart or a column graph The bar chart pie chart or a column graph The chart cannot be used for data entry chart cannot be used for data entry

Pivot TablesPivot Tables

A pivot table lets you summarize large amounts A pivot table lets you summarize large amounts of data in spreadsheet form The pivot table of data in spreadsheet form The pivot table requires that Microsoft Excel be installed on requires that Microsoft Excel be installed on the computer before the table can be created the computer before the table can be created Management and editing of the table is done Management and editing of the table is done with an OLE branch to Excel with an OLE branch to Excel

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 2: 38822345 MS Access Form Design

Course DescriptionCourse Description This is the fifth in a series of six workshops about Microsoft Access It deals This is the fifth in a series of six workshops about Microsoft Access It deals

specifically with form design specifically with form design The purpose of this installment is to expose you to the possibilities involved in The purpose of this installment is to expose you to the possibilities involved in

designing your database forms Form design is time consuming and requires some designing your database forms Form design is time consuming and requires some patience Learning the form design process is a considerable portion of the database patience Learning the form design process is a considerable portion of the database development process development process

Our goal is to assist you to learn the software understand some basic concepts and Our goal is to assist you to learn the software understand some basic concepts and show you some tips and techniques so you can develop your database show you some tips and techniques so you can develop your database managementprogramming skills over time managementprogramming skills over time

The six workshops are The six workshops are bull bull Introduction to Access Introduction to Access bull bull Access Queries Access Queries bull bull Access Reports Access Reports bull bull Access Database Design Access Database Design bull bull Access Form Design Access Form Design bull bull Access Macros Access Macros

Form BasicsForm Basics

Uses of Forms Uses of Forms Forms created in Microsoft Access are very much like Forms created in Microsoft Access are very much like

paper forms except they have a wider variety of paper forms except they have a wider variety of functions and uses They can be used to functions and uses They can be used to

bull bull Enter data into the database Enter data into the database Using a form for data entry not only saves time it is a Using a form for data entry not only saves time it is a

way to prevent errors Values can be selected from way to prevent errors Values can be selected from pull down lists thereby reducing the typing time and pull down lists thereby reducing the typing time and insuring that data entry rules are consistent insuring that data entry rules are consistent

bull bull View or browse data in the database View or browse data in the database A form can be used to view or browse through the data A form can be used to view or browse through the data

from a single record in form view or multiple records from a single record in form view or multiple records in tabular or datasheet view in tabular or datasheet view

bull bull Replicate source documents Replicate source documents An Access form can be created that looks exactly like the paper source An Access form can be created that looks exactly like the paper source

document or data collection form During data entry the user doesnt document or data collection form During data entry the user doesnt have to be concerned with finding the exact spot in the table to insert have to be concerned with finding the exact spot in the table to insert the data the form and its table links will position it in the correct table the data the form and its table links will position it in the correct table field field

bull bull Provide an attractive presentation of data Provide an attractive presentation of data The form can be designed to use a variety of fonts colors and special The form can be designed to use a variety of fonts colors and special

effects such as shading to enhance its appearance effects such as shading to enhance its appearance bull bull Calculate totals Calculate totals The form can extract raw numbers from a table record calculate totals or The form can extract raw numbers from a table record calculate totals or

evaluate mathematical expressions and display the results as a part of evaluate mathematical expressions and display the results as a part of the form bull the form bull Hold a chart or pivot table Hold a chart or pivot table

A form can be used to display data in a graphical format (such as a bar A form can be used to display data in a graphical format (such as a bar chart or a pie chart) or in a Microsoft Excel pivot table format These chart or a pie chart) or in a Microsoft Excel pivot table format These forms can only be used to display data they cannot be used for data forms can only be used to display data they cannot be used for data entry entry

bull bull Display data from more than one table Display data from more than one table The form can be based on a multiple table query instead of a single table The form can be based on a multiple table query instead of a single table

Using this feature you can access the data in several tables Using this feature you can access the data in several tables simultaneously simultaneously

Form ObjectsForm Objects All of the information on a form is contained in controls Controls are objects on a All of the information on a form is contained in controls Controls are objects on a

form that are used to display data perform actions or decorate the form form that are used to display data perform actions or decorate the form bull bull Some controls are Some controls are bound bound (linked) to fields in a table or a query These controls can (linked) to fields in a table or a query These controls can

place data into the fields or display data from the fields place data into the fields or display data from the fields bull bull Different types of controls or objects are used to display different data types a Different types of controls or objects are used to display different data types a text text

box box is used to display data and numbers an is used to display data and numbers an object box object box is used to display pictures is used to display pictures and other controls display information that is part of the form design and other controls display information that is part of the form design

bull bull Labels Labels are controls that are used to display descriptive text while are controls that are used to display descriptive text while lines lines and and squares squares are controls that are used to organize or separate data are controls that are used to organize or separate data

bull bull The The image image control is used to enhance the appearance of the form with a logo clip art control is used to enhance the appearance of the form with a logo clip art or some other graphic file If you want each database record to have a different or some other graphic file If you want each database record to have a different image (eg employee photographs) then use a bound object control instead image (eg employee photographs) then use a bound object control instead

bull bull Calculated controls Calculated controls act like bound controls but are used to display the results of a act like bound controls but are used to display the results of a calculation Frequently the parameters used in the underlying formula are other calculation Frequently the parameters used in the underlying formula are other controls on the form controls on the form

Creation MethodsCreation Methods

Access contains several ways to create a form You can design the form Access contains several ways to create a form You can design the form yourself by placing controls on a blank grid or you can use one of the yourself by placing controls on a blank grid or you can use one of the built-in Wizards The most common approach is to use a wizard to develop built-in Wizards The most common approach is to use a wizard to develop the basic design of the form (a rough draft) and then switch to the design the basic design of the form (a rough draft) and then switch to the design view for form customization view for form customization

bull bull Build From Scratch Build From Scratch You as the user can enter controls labels and links to the data in the You as the user can enter controls labels and links to the data in the

underlying tables in the design view of a form underlying tables in the design view of a form bull bull Autoform Wizards Autoform Wizards

Each of the autoform wizards produces a simple preformatted form in Each of the autoform wizards produces a simple preformatted form in either columnar tabular or datasheet format Each wizard works either columnar tabular or datasheet format Each wizard works automatically without prompting from the userautomatically without prompting from the user

bull bull Other Wizards Other Wizards Other form wizards are available that will produce columnar tabular Other form wizards are available that will produce columnar tabular datasheet justified chart or pivot table forms Each wizard prompts the datasheet justified chart or pivot table forms Each wizard prompts the user with a series of questions and bases the form on the answersuser with a series of questions and bases the form on the answers

Sources of DataSources of Data

When a form is used to enter update or display When a form is used to enter update or display data from a single table then you can connect data from a single table then you can connect or link the form directly to the table However or link the form directly to the table However if the form is to use data from multiple tables if the form is to use data from multiple tables then the tables should be linked together in a then the tables should be linked together in a query and the form based on the query query and the form based on the query

Microsoft Access forms are generally classified into one of these typesMicrosoft Access forms are generally classified into one of these types Columnar Columnar In a columnar form the values are all placed in one vertical In a columnar form the values are all placed in one vertical

column one item to a line and one record per form Access will place the column one item to a line and one record per form Access will place the data in newspaper style columns if the number of data items exceeds the data in newspaper style columns if the number of data items exceeds the form length form length

Tabular Tabular In a tabular form the data is placed in rows with field labels at In a tabular form the data is placed in rows with field labels at the top Multiple records can be displayed on a single form Tabular forms the top Multiple records can be displayed on a single form Tabular forms are best when you want to display multiple records with relatively few are best when you want to display multiple records with relatively few fields to prevent the need for left to right scrollingfields to prevent the need for left to right scrolling

Datasheet Datasheet A datasheet form will display multiple records in a typical A datasheet form will display multiple records in a typical datasheet view or single records in a tabular view This form is used datasheet view or single records in a tabular view This form is used mainly as a subform mainly as a subform

Justified Justified Available through the Form Wizard lays out fields in a staggered Available through the Form Wizard lays out fields in a staggered compact manner compact manner

MainSubformMainSubform A A mainsubformmainsubform form is used to show a one to many form is used to show a one to many

relationship between the main form and the subform The relationship between the main form and the subform The main (or one side) is displayed in single column format on the main (or one side) is displayed in single column format on the top of the form while the subform (or many side) is displayed top of the form while the subform (or many side) is displayed in a datasheet format on the bottom of the form The subform in a datasheet format on the bottom of the form The subform can be used to display one or more records that are related to can be used to display one or more records that are related to the main form There is a subform wizard button available in the main form There is a subform wizard button available in the Form Design Toolbox the Form Design Toolbox

minus minus Linked Forms Linked Forms The main form in a linked form set contains a button that branches to or The main form in a linked form set contains a button that branches to or

opens another form related to the first The second form is displayed in its opens another form related to the first The second form is displayed in its own window generally on top of the first form Closing the second form own window generally on top of the first form Closing the second form returns control to the main form returns control to the main form

ChartsCharts

The chart form displays data as a graph such as a The chart form displays data as a graph such as a bar chart pie chart or a column graph The bar chart pie chart or a column graph The chart cannot be used for data entry chart cannot be used for data entry

Pivot TablesPivot Tables

A pivot table lets you summarize large amounts A pivot table lets you summarize large amounts of data in spreadsheet form The pivot table of data in spreadsheet form The pivot table requires that Microsoft Excel be installed on requires that Microsoft Excel be installed on the computer before the table can be created the computer before the table can be created Management and editing of the table is done Management and editing of the table is done with an OLE branch to Excel with an OLE branch to Excel

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 3: 38822345 MS Access Form Design

Form BasicsForm Basics

Uses of Forms Uses of Forms Forms created in Microsoft Access are very much like Forms created in Microsoft Access are very much like

paper forms except they have a wider variety of paper forms except they have a wider variety of functions and uses They can be used to functions and uses They can be used to

bull bull Enter data into the database Enter data into the database Using a form for data entry not only saves time it is a Using a form for data entry not only saves time it is a

way to prevent errors Values can be selected from way to prevent errors Values can be selected from pull down lists thereby reducing the typing time and pull down lists thereby reducing the typing time and insuring that data entry rules are consistent insuring that data entry rules are consistent

bull bull View or browse data in the database View or browse data in the database A form can be used to view or browse through the data A form can be used to view or browse through the data

from a single record in form view or multiple records from a single record in form view or multiple records in tabular or datasheet view in tabular or datasheet view

bull bull Replicate source documents Replicate source documents An Access form can be created that looks exactly like the paper source An Access form can be created that looks exactly like the paper source

document or data collection form During data entry the user doesnt document or data collection form During data entry the user doesnt have to be concerned with finding the exact spot in the table to insert have to be concerned with finding the exact spot in the table to insert the data the form and its table links will position it in the correct table the data the form and its table links will position it in the correct table field field

bull bull Provide an attractive presentation of data Provide an attractive presentation of data The form can be designed to use a variety of fonts colors and special The form can be designed to use a variety of fonts colors and special

effects such as shading to enhance its appearance effects such as shading to enhance its appearance bull bull Calculate totals Calculate totals The form can extract raw numbers from a table record calculate totals or The form can extract raw numbers from a table record calculate totals or

evaluate mathematical expressions and display the results as a part of evaluate mathematical expressions and display the results as a part of the form bull the form bull Hold a chart or pivot table Hold a chart or pivot table

A form can be used to display data in a graphical format (such as a bar A form can be used to display data in a graphical format (such as a bar chart or a pie chart) or in a Microsoft Excel pivot table format These chart or a pie chart) or in a Microsoft Excel pivot table format These forms can only be used to display data they cannot be used for data forms can only be used to display data they cannot be used for data entry entry

bull bull Display data from more than one table Display data from more than one table The form can be based on a multiple table query instead of a single table The form can be based on a multiple table query instead of a single table

Using this feature you can access the data in several tables Using this feature you can access the data in several tables simultaneously simultaneously

Form ObjectsForm Objects All of the information on a form is contained in controls Controls are objects on a All of the information on a form is contained in controls Controls are objects on a

form that are used to display data perform actions or decorate the form form that are used to display data perform actions or decorate the form bull bull Some controls are Some controls are bound bound (linked) to fields in a table or a query These controls can (linked) to fields in a table or a query These controls can

place data into the fields or display data from the fields place data into the fields or display data from the fields bull bull Different types of controls or objects are used to display different data types a Different types of controls or objects are used to display different data types a text text

box box is used to display data and numbers an is used to display data and numbers an object box object box is used to display pictures is used to display pictures and other controls display information that is part of the form design and other controls display information that is part of the form design

bull bull Labels Labels are controls that are used to display descriptive text while are controls that are used to display descriptive text while lines lines and and squares squares are controls that are used to organize or separate data are controls that are used to organize or separate data

bull bull The The image image control is used to enhance the appearance of the form with a logo clip art control is used to enhance the appearance of the form with a logo clip art or some other graphic file If you want each database record to have a different or some other graphic file If you want each database record to have a different image (eg employee photographs) then use a bound object control instead image (eg employee photographs) then use a bound object control instead

bull bull Calculated controls Calculated controls act like bound controls but are used to display the results of a act like bound controls but are used to display the results of a calculation Frequently the parameters used in the underlying formula are other calculation Frequently the parameters used in the underlying formula are other controls on the form controls on the form

Creation MethodsCreation Methods

Access contains several ways to create a form You can design the form Access contains several ways to create a form You can design the form yourself by placing controls on a blank grid or you can use one of the yourself by placing controls on a blank grid or you can use one of the built-in Wizards The most common approach is to use a wizard to develop built-in Wizards The most common approach is to use a wizard to develop the basic design of the form (a rough draft) and then switch to the design the basic design of the form (a rough draft) and then switch to the design view for form customization view for form customization

bull bull Build From Scratch Build From Scratch You as the user can enter controls labels and links to the data in the You as the user can enter controls labels and links to the data in the

underlying tables in the design view of a form underlying tables in the design view of a form bull bull Autoform Wizards Autoform Wizards

Each of the autoform wizards produces a simple preformatted form in Each of the autoform wizards produces a simple preformatted form in either columnar tabular or datasheet format Each wizard works either columnar tabular or datasheet format Each wizard works automatically without prompting from the userautomatically without prompting from the user

bull bull Other Wizards Other Wizards Other form wizards are available that will produce columnar tabular Other form wizards are available that will produce columnar tabular datasheet justified chart or pivot table forms Each wizard prompts the datasheet justified chart or pivot table forms Each wizard prompts the user with a series of questions and bases the form on the answersuser with a series of questions and bases the form on the answers

Sources of DataSources of Data

When a form is used to enter update or display When a form is used to enter update or display data from a single table then you can connect data from a single table then you can connect or link the form directly to the table However or link the form directly to the table However if the form is to use data from multiple tables if the form is to use data from multiple tables then the tables should be linked together in a then the tables should be linked together in a query and the form based on the query query and the form based on the query

Microsoft Access forms are generally classified into one of these typesMicrosoft Access forms are generally classified into one of these types Columnar Columnar In a columnar form the values are all placed in one vertical In a columnar form the values are all placed in one vertical

column one item to a line and one record per form Access will place the column one item to a line and one record per form Access will place the data in newspaper style columns if the number of data items exceeds the data in newspaper style columns if the number of data items exceeds the form length form length

Tabular Tabular In a tabular form the data is placed in rows with field labels at In a tabular form the data is placed in rows with field labels at the top Multiple records can be displayed on a single form Tabular forms the top Multiple records can be displayed on a single form Tabular forms are best when you want to display multiple records with relatively few are best when you want to display multiple records with relatively few fields to prevent the need for left to right scrollingfields to prevent the need for left to right scrolling

Datasheet Datasheet A datasheet form will display multiple records in a typical A datasheet form will display multiple records in a typical datasheet view or single records in a tabular view This form is used datasheet view or single records in a tabular view This form is used mainly as a subform mainly as a subform

Justified Justified Available through the Form Wizard lays out fields in a staggered Available through the Form Wizard lays out fields in a staggered compact manner compact manner

MainSubformMainSubform A A mainsubformmainsubform form is used to show a one to many form is used to show a one to many

relationship between the main form and the subform The relationship between the main form and the subform The main (or one side) is displayed in single column format on the main (or one side) is displayed in single column format on the top of the form while the subform (or many side) is displayed top of the form while the subform (or many side) is displayed in a datasheet format on the bottom of the form The subform in a datasheet format on the bottom of the form The subform can be used to display one or more records that are related to can be used to display one or more records that are related to the main form There is a subform wizard button available in the main form There is a subform wizard button available in the Form Design Toolbox the Form Design Toolbox

minus minus Linked Forms Linked Forms The main form in a linked form set contains a button that branches to or The main form in a linked form set contains a button that branches to or

opens another form related to the first The second form is displayed in its opens another form related to the first The second form is displayed in its own window generally on top of the first form Closing the second form own window generally on top of the first form Closing the second form returns control to the main form returns control to the main form

ChartsCharts

The chart form displays data as a graph such as a The chart form displays data as a graph such as a bar chart pie chart or a column graph The bar chart pie chart or a column graph The chart cannot be used for data entry chart cannot be used for data entry

Pivot TablesPivot Tables

A pivot table lets you summarize large amounts A pivot table lets you summarize large amounts of data in spreadsheet form The pivot table of data in spreadsheet form The pivot table requires that Microsoft Excel be installed on requires that Microsoft Excel be installed on the computer before the table can be created the computer before the table can be created Management and editing of the table is done Management and editing of the table is done with an OLE branch to Excel with an OLE branch to Excel

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 4: 38822345 MS Access Form Design

bull bull Replicate source documents Replicate source documents An Access form can be created that looks exactly like the paper source An Access form can be created that looks exactly like the paper source

document or data collection form During data entry the user doesnt document or data collection form During data entry the user doesnt have to be concerned with finding the exact spot in the table to insert have to be concerned with finding the exact spot in the table to insert the data the form and its table links will position it in the correct table the data the form and its table links will position it in the correct table field field

bull bull Provide an attractive presentation of data Provide an attractive presentation of data The form can be designed to use a variety of fonts colors and special The form can be designed to use a variety of fonts colors and special

effects such as shading to enhance its appearance effects such as shading to enhance its appearance bull bull Calculate totals Calculate totals The form can extract raw numbers from a table record calculate totals or The form can extract raw numbers from a table record calculate totals or

evaluate mathematical expressions and display the results as a part of evaluate mathematical expressions and display the results as a part of the form bull the form bull Hold a chart or pivot table Hold a chart or pivot table

A form can be used to display data in a graphical format (such as a bar A form can be used to display data in a graphical format (such as a bar chart or a pie chart) or in a Microsoft Excel pivot table format These chart or a pie chart) or in a Microsoft Excel pivot table format These forms can only be used to display data they cannot be used for data forms can only be used to display data they cannot be used for data entry entry

bull bull Display data from more than one table Display data from more than one table The form can be based on a multiple table query instead of a single table The form can be based on a multiple table query instead of a single table

Using this feature you can access the data in several tables Using this feature you can access the data in several tables simultaneously simultaneously

Form ObjectsForm Objects All of the information on a form is contained in controls Controls are objects on a All of the information on a form is contained in controls Controls are objects on a

form that are used to display data perform actions or decorate the form form that are used to display data perform actions or decorate the form bull bull Some controls are Some controls are bound bound (linked) to fields in a table or a query These controls can (linked) to fields in a table or a query These controls can

place data into the fields or display data from the fields place data into the fields or display data from the fields bull bull Different types of controls or objects are used to display different data types a Different types of controls or objects are used to display different data types a text text

box box is used to display data and numbers an is used to display data and numbers an object box object box is used to display pictures is used to display pictures and other controls display information that is part of the form design and other controls display information that is part of the form design

bull bull Labels Labels are controls that are used to display descriptive text while are controls that are used to display descriptive text while lines lines and and squares squares are controls that are used to organize or separate data are controls that are used to organize or separate data

bull bull The The image image control is used to enhance the appearance of the form with a logo clip art control is used to enhance the appearance of the form with a logo clip art or some other graphic file If you want each database record to have a different or some other graphic file If you want each database record to have a different image (eg employee photographs) then use a bound object control instead image (eg employee photographs) then use a bound object control instead

bull bull Calculated controls Calculated controls act like bound controls but are used to display the results of a act like bound controls but are used to display the results of a calculation Frequently the parameters used in the underlying formula are other calculation Frequently the parameters used in the underlying formula are other controls on the form controls on the form

Creation MethodsCreation Methods

Access contains several ways to create a form You can design the form Access contains several ways to create a form You can design the form yourself by placing controls on a blank grid or you can use one of the yourself by placing controls on a blank grid or you can use one of the built-in Wizards The most common approach is to use a wizard to develop built-in Wizards The most common approach is to use a wizard to develop the basic design of the form (a rough draft) and then switch to the design the basic design of the form (a rough draft) and then switch to the design view for form customization view for form customization

bull bull Build From Scratch Build From Scratch You as the user can enter controls labels and links to the data in the You as the user can enter controls labels and links to the data in the

underlying tables in the design view of a form underlying tables in the design view of a form bull bull Autoform Wizards Autoform Wizards

Each of the autoform wizards produces a simple preformatted form in Each of the autoform wizards produces a simple preformatted form in either columnar tabular or datasheet format Each wizard works either columnar tabular or datasheet format Each wizard works automatically without prompting from the userautomatically without prompting from the user

bull bull Other Wizards Other Wizards Other form wizards are available that will produce columnar tabular Other form wizards are available that will produce columnar tabular datasheet justified chart or pivot table forms Each wizard prompts the datasheet justified chart or pivot table forms Each wizard prompts the user with a series of questions and bases the form on the answersuser with a series of questions and bases the form on the answers

Sources of DataSources of Data

When a form is used to enter update or display When a form is used to enter update or display data from a single table then you can connect data from a single table then you can connect or link the form directly to the table However or link the form directly to the table However if the form is to use data from multiple tables if the form is to use data from multiple tables then the tables should be linked together in a then the tables should be linked together in a query and the form based on the query query and the form based on the query

Microsoft Access forms are generally classified into one of these typesMicrosoft Access forms are generally classified into one of these types Columnar Columnar In a columnar form the values are all placed in one vertical In a columnar form the values are all placed in one vertical

column one item to a line and one record per form Access will place the column one item to a line and one record per form Access will place the data in newspaper style columns if the number of data items exceeds the data in newspaper style columns if the number of data items exceeds the form length form length

Tabular Tabular In a tabular form the data is placed in rows with field labels at In a tabular form the data is placed in rows with field labels at the top Multiple records can be displayed on a single form Tabular forms the top Multiple records can be displayed on a single form Tabular forms are best when you want to display multiple records with relatively few are best when you want to display multiple records with relatively few fields to prevent the need for left to right scrollingfields to prevent the need for left to right scrolling

Datasheet Datasheet A datasheet form will display multiple records in a typical A datasheet form will display multiple records in a typical datasheet view or single records in a tabular view This form is used datasheet view or single records in a tabular view This form is used mainly as a subform mainly as a subform

Justified Justified Available through the Form Wizard lays out fields in a staggered Available through the Form Wizard lays out fields in a staggered compact manner compact manner

MainSubformMainSubform A A mainsubformmainsubform form is used to show a one to many form is used to show a one to many

relationship between the main form and the subform The relationship between the main form and the subform The main (or one side) is displayed in single column format on the main (or one side) is displayed in single column format on the top of the form while the subform (or many side) is displayed top of the form while the subform (or many side) is displayed in a datasheet format on the bottom of the form The subform in a datasheet format on the bottom of the form The subform can be used to display one or more records that are related to can be used to display one or more records that are related to the main form There is a subform wizard button available in the main form There is a subform wizard button available in the Form Design Toolbox the Form Design Toolbox

minus minus Linked Forms Linked Forms The main form in a linked form set contains a button that branches to or The main form in a linked form set contains a button that branches to or

opens another form related to the first The second form is displayed in its opens another form related to the first The second form is displayed in its own window generally on top of the first form Closing the second form own window generally on top of the first form Closing the second form returns control to the main form returns control to the main form

ChartsCharts

The chart form displays data as a graph such as a The chart form displays data as a graph such as a bar chart pie chart or a column graph The bar chart pie chart or a column graph The chart cannot be used for data entry chart cannot be used for data entry

Pivot TablesPivot Tables

A pivot table lets you summarize large amounts A pivot table lets you summarize large amounts of data in spreadsheet form The pivot table of data in spreadsheet form The pivot table requires that Microsoft Excel be installed on requires that Microsoft Excel be installed on the computer before the table can be created the computer before the table can be created Management and editing of the table is done Management and editing of the table is done with an OLE branch to Excel with an OLE branch to Excel

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 5: 38822345 MS Access Form Design

Form ObjectsForm Objects All of the information on a form is contained in controls Controls are objects on a All of the information on a form is contained in controls Controls are objects on a

form that are used to display data perform actions or decorate the form form that are used to display data perform actions or decorate the form bull bull Some controls are Some controls are bound bound (linked) to fields in a table or a query These controls can (linked) to fields in a table or a query These controls can

place data into the fields or display data from the fields place data into the fields or display data from the fields bull bull Different types of controls or objects are used to display different data types a Different types of controls or objects are used to display different data types a text text

box box is used to display data and numbers an is used to display data and numbers an object box object box is used to display pictures is used to display pictures and other controls display information that is part of the form design and other controls display information that is part of the form design

bull bull Labels Labels are controls that are used to display descriptive text while are controls that are used to display descriptive text while lines lines and and squares squares are controls that are used to organize or separate data are controls that are used to organize or separate data

bull bull The The image image control is used to enhance the appearance of the form with a logo clip art control is used to enhance the appearance of the form with a logo clip art or some other graphic file If you want each database record to have a different or some other graphic file If you want each database record to have a different image (eg employee photographs) then use a bound object control instead image (eg employee photographs) then use a bound object control instead

bull bull Calculated controls Calculated controls act like bound controls but are used to display the results of a act like bound controls but are used to display the results of a calculation Frequently the parameters used in the underlying formula are other calculation Frequently the parameters used in the underlying formula are other controls on the form controls on the form

Creation MethodsCreation Methods

Access contains several ways to create a form You can design the form Access contains several ways to create a form You can design the form yourself by placing controls on a blank grid or you can use one of the yourself by placing controls on a blank grid or you can use one of the built-in Wizards The most common approach is to use a wizard to develop built-in Wizards The most common approach is to use a wizard to develop the basic design of the form (a rough draft) and then switch to the design the basic design of the form (a rough draft) and then switch to the design view for form customization view for form customization

bull bull Build From Scratch Build From Scratch You as the user can enter controls labels and links to the data in the You as the user can enter controls labels and links to the data in the

underlying tables in the design view of a form underlying tables in the design view of a form bull bull Autoform Wizards Autoform Wizards

Each of the autoform wizards produces a simple preformatted form in Each of the autoform wizards produces a simple preformatted form in either columnar tabular or datasheet format Each wizard works either columnar tabular or datasheet format Each wizard works automatically without prompting from the userautomatically without prompting from the user

bull bull Other Wizards Other Wizards Other form wizards are available that will produce columnar tabular Other form wizards are available that will produce columnar tabular datasheet justified chart or pivot table forms Each wizard prompts the datasheet justified chart or pivot table forms Each wizard prompts the user with a series of questions and bases the form on the answersuser with a series of questions and bases the form on the answers

Sources of DataSources of Data

When a form is used to enter update or display When a form is used to enter update or display data from a single table then you can connect data from a single table then you can connect or link the form directly to the table However or link the form directly to the table However if the form is to use data from multiple tables if the form is to use data from multiple tables then the tables should be linked together in a then the tables should be linked together in a query and the form based on the query query and the form based on the query

Microsoft Access forms are generally classified into one of these typesMicrosoft Access forms are generally classified into one of these types Columnar Columnar In a columnar form the values are all placed in one vertical In a columnar form the values are all placed in one vertical

column one item to a line and one record per form Access will place the column one item to a line and one record per form Access will place the data in newspaper style columns if the number of data items exceeds the data in newspaper style columns if the number of data items exceeds the form length form length

Tabular Tabular In a tabular form the data is placed in rows with field labels at In a tabular form the data is placed in rows with field labels at the top Multiple records can be displayed on a single form Tabular forms the top Multiple records can be displayed on a single form Tabular forms are best when you want to display multiple records with relatively few are best when you want to display multiple records with relatively few fields to prevent the need for left to right scrollingfields to prevent the need for left to right scrolling

Datasheet Datasheet A datasheet form will display multiple records in a typical A datasheet form will display multiple records in a typical datasheet view or single records in a tabular view This form is used datasheet view or single records in a tabular view This form is used mainly as a subform mainly as a subform

Justified Justified Available through the Form Wizard lays out fields in a staggered Available through the Form Wizard lays out fields in a staggered compact manner compact manner

MainSubformMainSubform A A mainsubformmainsubform form is used to show a one to many form is used to show a one to many

relationship between the main form and the subform The relationship between the main form and the subform The main (or one side) is displayed in single column format on the main (or one side) is displayed in single column format on the top of the form while the subform (or many side) is displayed top of the form while the subform (or many side) is displayed in a datasheet format on the bottom of the form The subform in a datasheet format on the bottom of the form The subform can be used to display one or more records that are related to can be used to display one or more records that are related to the main form There is a subform wizard button available in the main form There is a subform wizard button available in the Form Design Toolbox the Form Design Toolbox

minus minus Linked Forms Linked Forms The main form in a linked form set contains a button that branches to or The main form in a linked form set contains a button that branches to or

opens another form related to the first The second form is displayed in its opens another form related to the first The second form is displayed in its own window generally on top of the first form Closing the second form own window generally on top of the first form Closing the second form returns control to the main form returns control to the main form

ChartsCharts

The chart form displays data as a graph such as a The chart form displays data as a graph such as a bar chart pie chart or a column graph The bar chart pie chart or a column graph The chart cannot be used for data entry chart cannot be used for data entry

Pivot TablesPivot Tables

A pivot table lets you summarize large amounts A pivot table lets you summarize large amounts of data in spreadsheet form The pivot table of data in spreadsheet form The pivot table requires that Microsoft Excel be installed on requires that Microsoft Excel be installed on the computer before the table can be created the computer before the table can be created Management and editing of the table is done Management and editing of the table is done with an OLE branch to Excel with an OLE branch to Excel

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 6: 38822345 MS Access Form Design

Creation MethodsCreation Methods

Access contains several ways to create a form You can design the form Access contains several ways to create a form You can design the form yourself by placing controls on a blank grid or you can use one of the yourself by placing controls on a blank grid or you can use one of the built-in Wizards The most common approach is to use a wizard to develop built-in Wizards The most common approach is to use a wizard to develop the basic design of the form (a rough draft) and then switch to the design the basic design of the form (a rough draft) and then switch to the design view for form customization view for form customization

bull bull Build From Scratch Build From Scratch You as the user can enter controls labels and links to the data in the You as the user can enter controls labels and links to the data in the

underlying tables in the design view of a form underlying tables in the design view of a form bull bull Autoform Wizards Autoform Wizards

Each of the autoform wizards produces a simple preformatted form in Each of the autoform wizards produces a simple preformatted form in either columnar tabular or datasheet format Each wizard works either columnar tabular or datasheet format Each wizard works automatically without prompting from the userautomatically without prompting from the user

bull bull Other Wizards Other Wizards Other form wizards are available that will produce columnar tabular Other form wizards are available that will produce columnar tabular datasheet justified chart or pivot table forms Each wizard prompts the datasheet justified chart or pivot table forms Each wizard prompts the user with a series of questions and bases the form on the answersuser with a series of questions and bases the form on the answers

Sources of DataSources of Data

When a form is used to enter update or display When a form is used to enter update or display data from a single table then you can connect data from a single table then you can connect or link the form directly to the table However or link the form directly to the table However if the form is to use data from multiple tables if the form is to use data from multiple tables then the tables should be linked together in a then the tables should be linked together in a query and the form based on the query query and the form based on the query

Microsoft Access forms are generally classified into one of these typesMicrosoft Access forms are generally classified into one of these types Columnar Columnar In a columnar form the values are all placed in one vertical In a columnar form the values are all placed in one vertical

column one item to a line and one record per form Access will place the column one item to a line and one record per form Access will place the data in newspaper style columns if the number of data items exceeds the data in newspaper style columns if the number of data items exceeds the form length form length

Tabular Tabular In a tabular form the data is placed in rows with field labels at In a tabular form the data is placed in rows with field labels at the top Multiple records can be displayed on a single form Tabular forms the top Multiple records can be displayed on a single form Tabular forms are best when you want to display multiple records with relatively few are best when you want to display multiple records with relatively few fields to prevent the need for left to right scrollingfields to prevent the need for left to right scrolling

Datasheet Datasheet A datasheet form will display multiple records in a typical A datasheet form will display multiple records in a typical datasheet view or single records in a tabular view This form is used datasheet view or single records in a tabular view This form is used mainly as a subform mainly as a subform

Justified Justified Available through the Form Wizard lays out fields in a staggered Available through the Form Wizard lays out fields in a staggered compact manner compact manner

MainSubformMainSubform A A mainsubformmainsubform form is used to show a one to many form is used to show a one to many

relationship between the main form and the subform The relationship between the main form and the subform The main (or one side) is displayed in single column format on the main (or one side) is displayed in single column format on the top of the form while the subform (or many side) is displayed top of the form while the subform (or many side) is displayed in a datasheet format on the bottom of the form The subform in a datasheet format on the bottom of the form The subform can be used to display one or more records that are related to can be used to display one or more records that are related to the main form There is a subform wizard button available in the main form There is a subform wizard button available in the Form Design Toolbox the Form Design Toolbox

minus minus Linked Forms Linked Forms The main form in a linked form set contains a button that branches to or The main form in a linked form set contains a button that branches to or

opens another form related to the first The second form is displayed in its opens another form related to the first The second form is displayed in its own window generally on top of the first form Closing the second form own window generally on top of the first form Closing the second form returns control to the main form returns control to the main form

ChartsCharts

The chart form displays data as a graph such as a The chart form displays data as a graph such as a bar chart pie chart or a column graph The bar chart pie chart or a column graph The chart cannot be used for data entry chart cannot be used for data entry

Pivot TablesPivot Tables

A pivot table lets you summarize large amounts A pivot table lets you summarize large amounts of data in spreadsheet form The pivot table of data in spreadsheet form The pivot table requires that Microsoft Excel be installed on requires that Microsoft Excel be installed on the computer before the table can be created the computer before the table can be created Management and editing of the table is done Management and editing of the table is done with an OLE branch to Excel with an OLE branch to Excel

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 7: 38822345 MS Access Form Design

Sources of DataSources of Data

When a form is used to enter update or display When a form is used to enter update or display data from a single table then you can connect data from a single table then you can connect or link the form directly to the table However or link the form directly to the table However if the form is to use data from multiple tables if the form is to use data from multiple tables then the tables should be linked together in a then the tables should be linked together in a query and the form based on the query query and the form based on the query

Microsoft Access forms are generally classified into one of these typesMicrosoft Access forms are generally classified into one of these types Columnar Columnar In a columnar form the values are all placed in one vertical In a columnar form the values are all placed in one vertical

column one item to a line and one record per form Access will place the column one item to a line and one record per form Access will place the data in newspaper style columns if the number of data items exceeds the data in newspaper style columns if the number of data items exceeds the form length form length

Tabular Tabular In a tabular form the data is placed in rows with field labels at In a tabular form the data is placed in rows with field labels at the top Multiple records can be displayed on a single form Tabular forms the top Multiple records can be displayed on a single form Tabular forms are best when you want to display multiple records with relatively few are best when you want to display multiple records with relatively few fields to prevent the need for left to right scrollingfields to prevent the need for left to right scrolling

Datasheet Datasheet A datasheet form will display multiple records in a typical A datasheet form will display multiple records in a typical datasheet view or single records in a tabular view This form is used datasheet view or single records in a tabular view This form is used mainly as a subform mainly as a subform

Justified Justified Available through the Form Wizard lays out fields in a staggered Available through the Form Wizard lays out fields in a staggered compact manner compact manner

MainSubformMainSubform A A mainsubformmainsubform form is used to show a one to many form is used to show a one to many

relationship between the main form and the subform The relationship between the main form and the subform The main (or one side) is displayed in single column format on the main (or one side) is displayed in single column format on the top of the form while the subform (or many side) is displayed top of the form while the subform (or many side) is displayed in a datasheet format on the bottom of the form The subform in a datasheet format on the bottom of the form The subform can be used to display one or more records that are related to can be used to display one or more records that are related to the main form There is a subform wizard button available in the main form There is a subform wizard button available in the Form Design Toolbox the Form Design Toolbox

minus minus Linked Forms Linked Forms The main form in a linked form set contains a button that branches to or The main form in a linked form set contains a button that branches to or

opens another form related to the first The second form is displayed in its opens another form related to the first The second form is displayed in its own window generally on top of the first form Closing the second form own window generally on top of the first form Closing the second form returns control to the main form returns control to the main form

ChartsCharts

The chart form displays data as a graph such as a The chart form displays data as a graph such as a bar chart pie chart or a column graph The bar chart pie chart or a column graph The chart cannot be used for data entry chart cannot be used for data entry

Pivot TablesPivot Tables

A pivot table lets you summarize large amounts A pivot table lets you summarize large amounts of data in spreadsheet form The pivot table of data in spreadsheet form The pivot table requires that Microsoft Excel be installed on requires that Microsoft Excel be installed on the computer before the table can be created the computer before the table can be created Management and editing of the table is done Management and editing of the table is done with an OLE branch to Excel with an OLE branch to Excel

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 8: 38822345 MS Access Form Design

Microsoft Access forms are generally classified into one of these typesMicrosoft Access forms are generally classified into one of these types Columnar Columnar In a columnar form the values are all placed in one vertical In a columnar form the values are all placed in one vertical

column one item to a line and one record per form Access will place the column one item to a line and one record per form Access will place the data in newspaper style columns if the number of data items exceeds the data in newspaper style columns if the number of data items exceeds the form length form length

Tabular Tabular In a tabular form the data is placed in rows with field labels at In a tabular form the data is placed in rows with field labels at the top Multiple records can be displayed on a single form Tabular forms the top Multiple records can be displayed on a single form Tabular forms are best when you want to display multiple records with relatively few are best when you want to display multiple records with relatively few fields to prevent the need for left to right scrollingfields to prevent the need for left to right scrolling

Datasheet Datasheet A datasheet form will display multiple records in a typical A datasheet form will display multiple records in a typical datasheet view or single records in a tabular view This form is used datasheet view or single records in a tabular view This form is used mainly as a subform mainly as a subform

Justified Justified Available through the Form Wizard lays out fields in a staggered Available through the Form Wizard lays out fields in a staggered compact manner compact manner

MainSubformMainSubform A A mainsubformmainsubform form is used to show a one to many form is used to show a one to many

relationship between the main form and the subform The relationship between the main form and the subform The main (or one side) is displayed in single column format on the main (or one side) is displayed in single column format on the top of the form while the subform (or many side) is displayed top of the form while the subform (or many side) is displayed in a datasheet format on the bottom of the form The subform in a datasheet format on the bottom of the form The subform can be used to display one or more records that are related to can be used to display one or more records that are related to the main form There is a subform wizard button available in the main form There is a subform wizard button available in the Form Design Toolbox the Form Design Toolbox

minus minus Linked Forms Linked Forms The main form in a linked form set contains a button that branches to or The main form in a linked form set contains a button that branches to or

opens another form related to the first The second form is displayed in its opens another form related to the first The second form is displayed in its own window generally on top of the first form Closing the second form own window generally on top of the first form Closing the second form returns control to the main form returns control to the main form

ChartsCharts

The chart form displays data as a graph such as a The chart form displays data as a graph such as a bar chart pie chart or a column graph The bar chart pie chart or a column graph The chart cannot be used for data entry chart cannot be used for data entry

Pivot TablesPivot Tables

A pivot table lets you summarize large amounts A pivot table lets you summarize large amounts of data in spreadsheet form The pivot table of data in spreadsheet form The pivot table requires that Microsoft Excel be installed on requires that Microsoft Excel be installed on the computer before the table can be created the computer before the table can be created Management and editing of the table is done Management and editing of the table is done with an OLE branch to Excel with an OLE branch to Excel

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 9: 38822345 MS Access Form Design

MainSubformMainSubform A A mainsubformmainsubform form is used to show a one to many form is used to show a one to many

relationship between the main form and the subform The relationship between the main form and the subform The main (or one side) is displayed in single column format on the main (or one side) is displayed in single column format on the top of the form while the subform (or many side) is displayed top of the form while the subform (or many side) is displayed in a datasheet format on the bottom of the form The subform in a datasheet format on the bottom of the form The subform can be used to display one or more records that are related to can be used to display one or more records that are related to the main form There is a subform wizard button available in the main form There is a subform wizard button available in the Form Design Toolbox the Form Design Toolbox

minus minus Linked Forms Linked Forms The main form in a linked form set contains a button that branches to or The main form in a linked form set contains a button that branches to or

opens another form related to the first The second form is displayed in its opens another form related to the first The second form is displayed in its own window generally on top of the first form Closing the second form own window generally on top of the first form Closing the second form returns control to the main form returns control to the main form

ChartsCharts

The chart form displays data as a graph such as a The chart form displays data as a graph such as a bar chart pie chart or a column graph The bar chart pie chart or a column graph The chart cannot be used for data entry chart cannot be used for data entry

Pivot TablesPivot Tables

A pivot table lets you summarize large amounts A pivot table lets you summarize large amounts of data in spreadsheet form The pivot table of data in spreadsheet form The pivot table requires that Microsoft Excel be installed on requires that Microsoft Excel be installed on the computer before the table can be created the computer before the table can be created Management and editing of the table is done Management and editing of the table is done with an OLE branch to Excel with an OLE branch to Excel

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 10: 38822345 MS Access Form Design

ChartsCharts

The chart form displays data as a graph such as a The chart form displays data as a graph such as a bar chart pie chart or a column graph The bar chart pie chart or a column graph The chart cannot be used for data entry chart cannot be used for data entry

Pivot TablesPivot Tables

A pivot table lets you summarize large amounts A pivot table lets you summarize large amounts of data in spreadsheet form The pivot table of data in spreadsheet form The pivot table requires that Microsoft Excel be installed on requires that Microsoft Excel be installed on the computer before the table can be created the computer before the table can be created Management and editing of the table is done Management and editing of the table is done with an OLE branch to Excel with an OLE branch to Excel

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 11: 38822345 MS Access Form Design

Pivot TablesPivot Tables

A pivot table lets you summarize large amounts A pivot table lets you summarize large amounts of data in spreadsheet form The pivot table of data in spreadsheet form The pivot table requires that Microsoft Excel be installed on requires that Microsoft Excel be installed on the computer before the table can be created the computer before the table can be created Management and editing of the table is done Management and editing of the table is done with an OLE branch to Excel with an OLE branch to Excel

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 12: 38822345 MS Access Form Design

Creating FormsCreating Forms

The general procedure for creating a form is The general procedure for creating a form is 1 In the Database Window click the 1 In the Database Window click the Forms Forms entry in the entry in the Objects Objects

list list 2 Click on the 2 Click on the New New button in the toolbar to display the button in the toolbar to display the New New

Form Form dialog box dialog box 3 Select the appropriate table or query in the Choose Table or 3 Select the appropriate table or query in the Choose Table or

Query field (click the 1048660 pop-up to display the list of available Query field (click the 1048660 pop-up to display the list of available tables and queries) tables and queries)

4 Select a Wizard or Design View from the list and click the 4 Select a Wizard or Design View from the list and click the OK OK button button

If you choose a wizard follow the instructions in the Wizard If you choose a wizard follow the instructions in the Wizard dialog boxes Click the dialog boxes Click the Next Next button after each step to continue button after each step to continue through a Wizard through a Wizard

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 13: 38822345 MS Access Form Design

Activity 1 - Use an Autoform WizardActivity 1 - Use an Autoform Wizard

Create a form to add or update information in the class table using the Tabular Create a form to add or update information in the class table using the Tabular AutoForm Wizard AutoForm Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Click 3 Click New New button in the Database window button in the Database window toolbartoolbar 4 Select the 4 Select the Class Class table table 5 Select the 5 Select the AutoForm Tabular AutoForm Tabular format format 6 Click the 6 Click the OK OK button button 7 The form is created and displayed on screen 7 The form is created and displayed on screen 8 To save the form for future use close it and respond 8 To save the form for future use close it and respond Yes Yes to the to the Save Save

Changes Changes dialog box When the dialog box When the Save As Save As dialog box appears name it dialog box appears name it Class Class EntryEntry

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 14: 38822345 MS Access Form Design

Activity 2 - Use an Interactive Form Activity 2 - Use an Interactive Form WizardWizard

Create a columnar form to add or update information in the Teacher table using the Create a columnar form to add or update information in the Teacher table using the Form Wizard Form Wizard

1 Open the sample database 1 Open the sample database SCHOOL4MDB SCHOOL4MDB if it is not already open if it is not already open 2 In the 2 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list 3 Select the 3 Select the Teacher Teacher table table 4 Select the 4 Select the Form Wizard Form Wizard format and click the format and click the OK OK button button 5 When the wizard asks which fields to include click the 5 When the wizard asks which fields to include click the All All button (marked with button (marked with gtgtgtgt) )

click the click the Next Next button button 6 Select the 6 Select the Columnar Columnar layout and click the layout and click the Next Next button button 7 Select a style for the form and click the 7 Select a style for the form and click the Next Next button button 8 Give the form the title 8 Give the form the title Teacher Records Teacher Records and click the and click the Finish Finish button Note this title button Note this title

will be used to name the form as it is being saved will be used to name the form as it is being saved 9 Close the form and save any changes if prompted to do so 9 Close the form and save any changes if prompted to do so Creating forms in the Design View is a little more complicated and requires a more in-Creating forms in the Design View is a little more complicated and requires a more in-

depth discussion of the design screens options and tools that are available within depth discussion of the design screens options and tools that are available within Access These items will be covered in the next section Access These items will be covered in the next section

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 15: 38822345 MS Access Form Design

Activity 3 Environment overviewActivity 3 Environment overview

1 Open the Teacher Records form in Design View 1 Open the Teacher Records form in Design View 2 Make sure the ruler grid toolbox and field list are 2 Make sure the ruler grid toolbox and field list are

visible visible 3 Move the floating field list to the side if you need to 3 Move the floating field list to the side if you need to 4 Shape your floating toolbox to appear as the one on 4 Shape your floating toolbox to appear as the one on

page 9 page 9 5 Put your mouse over each tool to see the tool tips 5 Put your mouse over each tool to see the tool tips

appear appear 6 Change back and forth between Form view 6 Change back and forth between Form view

Datasheet View and Design View Datasheet View and Design View 7 While in Form view perform a Print Preview 7 While in Form view perform a Print Preview

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 16: 38822345 MS Access Form Design

Designing a FormDesigning a Form

Views in the Form Window Views in the Form Window The form window has four possible views The form window has four possible views bull bull Design view Design view Design view is used to access the design screen to create a new Design view is used to access the design screen to create a new

form or to change the structure of an existing form form or to change the structure of an existing form Commands Commands - Select form and click Design button in the database - Select form and click Design button in the database

window toolbar window toolbar - Right mouse click on form and select Design view shortcut - Right mouse click on form and select Design view shortcut - If form is open in Form view right mouse click in title bar - If form is open in Form view right mouse click in title bar

and select the and select the Design View Design View shortcut shortcut

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 17: 38822345 MS Access Form Design

Form viewForm view

Form view is used to enter change or view data using Form view is used to enter change or view data using the form itself In form view you can usually see all the form itself In form view you can usually see all of the fields for one record at once of the fields for one record at once

Commands Commands - Select form and click - Select form and click Open Open button in the database button in the database

window toolbar window toolbar - Double-click a form object - Double-click a form object - Right mouse click on a form object and select - Right mouse click on a form object and select Open Open

shortcut shortcut - If the form is open in Design view right mouse click - If the form is open in Design view right mouse click

in title bar and select the in title bar and select the Form View Form View shortcut shortcut

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 18: 38822345 MS Access Form Design

Datasheet viewDatasheet view

Datasheet view is used to view enter or Datasheet view is used to view enter or change data using a datasheet You can usually change data using a datasheet You can usually see many records at once but it does not see many records at once but it does not display pictures or other OLE objects display pictures or other OLE objects

Commands Commands - In - In Form Form view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut - In - In Design Design view right mouse click in the title view right mouse click in the title

bar and select the bar and select the Datasheet View Datasheet View shortcut shortcut

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 19: 38822345 MS Access Form Design

Print previewPrint preview

It is used to see how a form will look when It is used to see how a form will look when printed printed

Commands Commands

- - Print preview Print preview is available from the is available from the File File menu menu

- Click the - Click the Print Preview Print Preview button on the toolbar button on the toolbar

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 20: 38822345 MS Access Form Design

Inserting Controls into the FormInserting Controls into the Form

A control on a form is classified by the source of A control on a form is classified by the source of the information that it displays the information that it displays

Bound Bound controls are connected or linked to a data controls are connected or linked to a data field in a table or query field in a table or query

Unbound Unbound controls do not have a source of data controls do not have a source of data They are used to display labels or instructions They are used to display labels or instructions

Calculated Calculated controls use an expression as the controls use an expression as the control source and display the results of the control source and display the results of the expression expression

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 21: 38822345 MS Access Form Design

Control ToolboxControl Toolbox The Toolbox is a special type of toolbar that is used to create controls The toolbox is The Toolbox is a special type of toolbar that is used to create controls The toolbox is

automatically displayed when you enter the form design view You can move the automatically displayed when you enter the form design view You can move the toolbox around the work area by dragging it or you can click on the control box to toolbox around the work area by dragging it or you can click on the control box to close it close it

When a tool is in use it is outlined with a small square indicating it is active When a tool is in use it is outlined with a small square indicating it is active Option Group Option Group if you are going to use this create it before you create the buttons if you are going to use this create it before you create the buttons

to go inside it Select the tool and draw the box on your form Then create option to go inside it Select the tool and draw the box on your form Then create option buttons check boxes or toggle buttons buttons check boxes or toggle buttons

When a When a command button command button is clicked on a form the button will run a program or is clicked on a form the button will run a program or macro or perform some operation such as macro or perform some operation such as go to first record go to first record or or close formclose form

Toggle ButtonsToggle Buttons Option ButtonsOption Buttons and and Check Boxes Check Boxes work best for yesno work best for yesno truefalse type variables When the item is selected the value is True or 1 When it truefalse type variables When the item is selected the value is True or 1 When it is left blank the value is False or 0 is left blank the value is False or 0

These buttons can be used as part of an option group to create mutually exclusive These buttons can be used as part of an option group to create mutually exclusive choices In a group the first button created will have the value of 1 second buttons choices In a group the first button created will have the value of 1 second buttons value will be 2 etc 9 value will be 2 etc 9

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 22: 38822345 MS Access Form Design

Creating a bound text box controlCreating a bound text box control

There are two ways to create a bound control Either of these There are two ways to create a bound control Either of these methods result in a pair of controls a bound control used to methods result in a pair of controls a bound control used to display data from the table and an unbound control used to display data from the table and an unbound control used to label the bound control label the bound control

The easiest method is to The easiest method is to drag the field from the field list to the drag the field from the field list to the formform creating a text box control by default The control will creating a text box control by default The control will be assigned a label that is the same as the field name or be assigned a label that is the same as the field name or caption It also inherits most of the properties from the caption It also inherits most of the properties from the connected field connected field

1 Open the form in 1 Open the form in Design Design view view 2 Select the 2 Select the Field List Field List command from the command from the View View menu This menu This

displays the field list in a separate window displays the field list in a separate window 3 From the field list drag the field(s) to the desired position on 3 From the field list drag the field(s) to the desired position on

the form the form

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 23: 38822345 MS Access Form Design

Alternatively you can Alternatively you can create the control using the toolbox create the control using the toolbox and and then assign the field name in the controlrsquos property sheet then assign the field name in the controlrsquos property sheet

1 Open the form in design view For a new form specify the 1 Open the form in design view For a new form specify the table or query that is to be connected to the form table or query that is to be connected to the form

2 Select the control from the toolbox and position it on the form 2 Select the control from the toolbox and position it on the form 3 Click on the control with the right mouse button and choose 3 Click on the control with the right mouse button and choose

PropertiesProperties or double-click on the control and select or double-click on the control and select Properties or click on the control to select it and then click on Properties or click on the control to select it and then click on the Properties button the Properties button

4 Select the 4 Select the Control Source Control Source property and select the field from property and select the field from the pull down menu the pull down menu

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 24: 38822345 MS Access Form Design

Activity 4 Toolbox overviewActivity 4 Toolbox overview

1 Open the Teacher Records form in Design View if it is not still 1 Open the Teacher Records form in Design View if it is not still open open

2 Drag a field from the field list onto the form 2 Drag a field from the field list onto the form 3 Use the Text tool to add some text to the form 3 Use the Text tool to add some text to the form 4 Use the Text Box tool to add an unbound field to the form 4 Use the Text Box tool to add an unbound field to the form 5 Practice using the utility functions listed on the next page 5 Practice using the utility functions listed on the next page

select move resize select move resize During the design process controls may need some minor During the design process controls may need some minor

changes in their size or position The process of selecting changes in their size or position The process of selecting moving sizing or copying is the same for all types of controls moving sizing or copying is the same for all types of controls on both forms and reports on both forms and reports

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 25: 38822345 MS Access Form Design

Selecting Selecting You can select a control by clicking on it with the mouse button To select several controls You can select a control by clicking on it with the mouse button To select several controls

hold down the Shift key while clicking on the objects You also use a marquee (with the hold down the Shift key while clicking on the objects You also use a marquee (with the pointer tool selected draw a box around the objects) to select multiple objects The selected pointer tool selected draw a box around the objects) to select multiple objects The selected item(s) will have sizing handles around the edges item(s) will have sizing handles around the edges

Moving a control Moving a control Click on the control when the cursor looks like a flat hand and drag it to a new location Click on the control when the cursor looks like a flat hand and drag it to a new location Moving a label or data box Moving a label or data box To move a label or data box separately click on the larger square in the upper left corner of the To move a label or data box separately click on the larger square in the upper left corner of the

object and drag amp drop while the cursor looks like a pointing finger object and drag amp drop while the cursor looks like a pointing finger Resizing a label or data box Resizing a label or data box Position the cursor over one of the square boxes (sizing handles) and it will change into a double Position the cursor over one of the square boxes (sizing handles) and it will change into a double

arrow Drag and drop this arrow cursor to change the size of the control arrow Drag and drop this arrow cursor to change the size of the control Copying and deleting Copying and deleting Select the control and choose the Select the control and choose the Duplicate Duplicate command from the command from the Edit Edit menu to obtain a duplicate of menu to obtain a duplicate of

the control directly below the original You can also select the control and use the standard the control directly below the original You can also select the control and use the standard Cut Copy and Paste commands or you can press the Delete key to remove the selected Cut Copy and Paste commands or you can press the Delete key to remove the selected control(s) control(s)

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 26: 38822345 MS Access Form Design

Activity5 - Creating and Modifying a Form Activity5 - Creating and Modifying a Form without a Wizardwithout a Wizard

1 In the 1 In the Database Database window click the window click the Forms Forms entry in the entry in the Objects Objects list list

2 Click the 2 Click the New New button in the toolbar Select the button in the toolbar Select the Design View Design View option option

3 Select the 3 Select the STUDENT STUDENT table Click the table Click the OK OK button button 4 Make sure the toolbox ruler field list and grid are displayed 4 Make sure the toolbox ruler field list and grid are displayed minus minus Use the View menu to turn these display options on off Use the View menu to turn these display options on off 5 Establish the size of your form Make it 4 inches across and 5 Establish the size of your form Make it 4 inches across and

25 inches deep 25 inches deep minus minus Drag amp drop the pagersquos edges to change its size Drag amp drop the pagersquos edges to change its size

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 27: 38822345 MS Access Form Design

6 Put 3 text box controls on your form 6 Put 3 text box controls on your form minus minus Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Open the Field list (View menu) then drag amp drop S-FName S-LName and S-Score Score

from the field list box to your form from the field list box to your form 7 Position the fields on the form (drag while the cursor looks like a hand) 7 Position the fields on the form (drag while the cursor looks like a hand) 8 Make at least one of the data boxes wider (click on a white box to select it drag amp 8 Make at least one of the data boxes wider (click on a white box to select it drag amp

drop a black square resizing handle) drop a black square resizing handle) 9 Move a label in relation to its data box (click on the big square in the upper left 9 Move a label in relation to its data box (click on the big square in the upper left

corner) corner) 10 Save your form by clicking on the 10 Save your form by clicking on the Save Save button button 11 Change the 11 Change the background background color color minus minus Right mouse click on the background area and choose the Right mouse click on the background area and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab and then click in the tab and then click in the Back Color Back Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Click the Click the OK OK button and close the properties dialog box button and close the properties dialog box 12 Change a label text color 12 Change a label text color minus minus Right mouse click on a label and choose the Right mouse click on a label and choose the Properties Properties shortcut shortcut minus minus Click the Click the Format Format tab scroll down click in the tab scroll down click in the Fore Color Fore Color field field minus minus Click the 3 dots () and select a color from the dialog box Click the 3 dots () and select a color from the dialog box minus minus Change other characteristics (font style) of the text as desired Change other characteristics (font style) of the text as desired minus minus Close the properties dialog box Close the properties dialog box 13 Save your form again 13 Save your form again Keep this form open we will add other controls to it as we work through this sectionKeep this form open we will add other controls to it as we work through this section

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 28: 38822345 MS Access Form Design

Form SectionsForm Sections Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to Microsoft Access forms can have up to five sections that can be entered in any combination It is possible to

have different sections for different views of the form have different sections for different views of the form Microsoft Access forms can have up to five sections that can be entered in any combination It is possible Microsoft Access forms can have up to five sections that can be entered in any combination It is possible

to have different sections for different views of the formto have different sections for different views of the form Form Header Form Header The form header displays a title for the form along with control buttons andor instructions In form view the The form header displays a title for the form along with control buttons andor instructions In form view the

header appears at the top of the screen When printed the header appears at the top of the first page The header appears at the top of the screen When printed the header appears at the top of the first page The header is not used in datasheet view header is not used in datasheet view

Page Header Page Header The page header is only used on printed forms and appears at the top of each page It is used to display titles The page header is only used on printed forms and appears at the top of each page It is used to display titles

column headers and other information column headers and other information Detail Section Detail Section The detail section is used to display records of data It will display one or more records on a single screen or The detail section is used to display records of data It will display one or more records on a single screen or

page page Page Footer Page Footer The page footer is only used on printed forms and it appears at the bottom of each page It is used to display The page footer is only used on printed forms and it appears at the bottom of each page It is used to display

data like the page number or date data like the page number or date Form Footer Form Footer The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is The form footer appears at the bottom of the screen in form view and at the end of the printout when the form is

printed It is not used in the datasheet view printed It is not used in the datasheet view

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 29: 38822345 MS Access Form Design

Notes on using the form sectionsNotes on using the form sections

The size of a section can be changed by The size of a section can be changed by dragging the edges in design view dragging the edges in design view

To add or remove sections to a form choose To add or remove sections to a form choose Form HeaderFooter or Page HeaderFooter Form HeaderFooter or Page HeaderFooter from the View menu in design view from the View menu in design view

Like other objects in the database form Like other objects in the database form sections have properties In design view right sections have properties In design view right click on the section or select View Properties click on the section or select View Properties from the menu to access the properties from the menu to access the properties

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 30: 38822345 MS Access Form Design

1 Open your Student Form created in the previous 1 Open your Student Form created in the previous activity activity

2 Go to the 2 Go to the View View menu and select menu and select Form Header and Form Header and FooterFooter

3 Use the Label tool to insert some text into the Form 3 Use the Label tool to insert some text into the Form Header Header

4 Modify the texts location and appearance if 4 Modify the texts location and appearance if necessary necessary

5 Adjust the size of your header 5 Adjust the size of your header 6 Save and view your form 6 Save and view your form

Activity 6 - Add a header to your formActivity 6 - Add a header to your form

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 31: 38822345 MS Access Form Design

Setting control propertiesSetting control properties

Throughout Access properties are used to determine the look or Throughout Access properties are used to determine the look or characteristics of objects Controls on forms also have properties that can characteristics of objects Controls on forms also have properties that can be used to change the structure appearance and contents of the control be used to change the structure appearance and contents of the control

bullbullControl property sheet Control property sheet To see the control property sheet right click or double click on the control To see the control property sheet right click or double click on the control

You can also select the control then click on the properties button Note You can also select the control then click on the properties button Note that if the control has an attached label it has a separate set of properties that if the control has an attached label it has a separate set of properties

Changing several controls Changing several controls You can change the properties of several controls at once by displaying the You can change the properties of several controls at once by displaying the

property sheet for one control then select additional controls of the same property sheet for one control then select additional controls of the same type (hold down the shift key and click on the other controls) type (hold down the shift key and click on the other controls)

Changing default properties Changing default properties You can change the default properties for a type of control by displaying the You can change the default properties for a type of control by displaying the

property sheet for one control and then click on the tool type in the property sheet for one control and then click on the tool type in the toolbox Access will display the default properties for that type of control toolbox Access will display the default properties for that type of control

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 32: 38822345 MS Access Form Design

Data display formats Data display formats The way the data is displayed in the control can be The way the data is displayed in the control can be

changed by setting the Format property of the control changed by setting the Format property of the control Instructions on the Status Bar Instructions on the Status Bar You can display messages on the status bar by changing You can display messages on the status bar by changing

the StatusBarText property of the control the StatusBarText property of the control Validation of data Validation of data To avoid mistakes when entering data into forms you To avoid mistakes when entering data into forms you

can alter the DefaultValue ValidationRule can alter the DefaultValue ValidationRule ValidationText and InputMask properties ValidationText and InputMask properties

bullbullMultiple lines in text boxes Multiple lines in text boxes Multiple lines of text can be placed in a text box by Multiple lines of text can be placed in a text box by

sizing the box If desired the ScrollBar property can sizing the box If desired the ScrollBar property can be set to include scroll bars in the text box be set to include scroll bars in the text box

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 33: 38822345 MS Access Form Design

A bound control will inherit the lookup format A bound control will inherit the lookup format input mask caption default value validation input mask caption default value validation rule validation text and decimal places rule validation text and decimal places properties from the underlying table fields properties from the underlying table fields However the validation rule validation text However the validation rule validation text and default value settings will not appear in and default value settings will not appear in the property sheet for the form Any entries the property sheet for the form Any entries made in the property sheet will override or made in the property sheet will override or append to these properties append to these properties

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 34: 38822345 MS Access Form Design

Customizing the FormCustomizing the Form Access offers a wide variety of controls that can be used to make your form easier Access offers a wide variety of controls that can be used to make your form easier

to use and more visually appealing Some of the more common or useful to use and more visually appealing Some of the more common or useful controls are controls are

bull bull Using a list box or combo box Using a list box or combo box A list box allows you to make choices from a simple list of values A combo box A list box allows you to make choices from a simple list of values A combo box

is like a list box and a text box in one control you can choose from the items is like a list box and a text box in one control you can choose from the items in the list or type in your own item like a text box In either case the list can be in the list or type in your own item like a text box In either case the list can be field values from a table or query or it can be values entered into a value list field values from a table or query or it can be values entered into a value list

1 From the 1 From the View View menu turn off the menu turn off the Control Wizard Control Wizard if you plan to create a list if you plan to create a list box box

2 In the toolbox select either the 2 In the toolbox select either the List Box List Box or the or the Combo BoxCombo Box 3 Click and drag (draw a box) on the form where you want to place the control 3 Click and drag (draw a box) on the form where you want to place the control 4 Set the 4 Set the Control Source Control Source property of the box to bind it to the desired field property of the box to bind it to the desired field 5 Set the 5 Set the RowSourceType RowSourceType property to indicate what type of data should be property to indicate what type of data should be

displayed in the control displayed in the control 6 Set the 6 Set the RowSource RowSource property to indicate the source of the data When creating a property to indicate the source of the data When creating a

list of values place them in the list of values place them in the RowSource RowSource property separated by semicolons property separated by semicolons

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 35: 38822345 MS Access Form Design

Activity 7 - Add a Combo Box and a List Box to Activity 7 - Add a Combo Box and a List Box to

your Student Formyour Student Form 1 Make sure the 1 Make sure the Control Wizard Control Wizard button is pushed in (active) button is pushed in (active) 2 Click on the 2 Click on the Combo Box Combo Box tool and draw a thin box on your form tool and draw a thin box on your form 3 Answer the Wizards questions you will supply the values (for major)3 Answer the Wizards questions you will supply the values (for major) choose choose S-MajorS-Major etc etc 4 Move the combo box label over top of the data portion 4 Move the combo box label over top of the data portion 5 Now turn 5 Now turn off off the Control Wizard the Control Wizard 6 Click on the 6 Click on the List Box List Box tool and draw a box on your form tool and draw a box on your form 7 Click on the 7 Click on the Properties Properties button to display current properties for this control button to display current properties for this control 8 Click on the Data tab and set 8 Click on the Data tab and set Control Source Control Source to the desired field to the desired field S-HairS-Hair 9 Under the Data tab set 9 Under the Data tab set Row Source Type Row Source Type to be to be Value ListValue List 10 Next to Row Source enter red blonde brown black random bald 10 Next to Row Source enter red blonde brown black random bald

purple purple 11 Close the Properties box Move or resize your list box control as needed 11 Close the Properties box Move or resize your list box control as needed

Save your form Save your form

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 36: 38822345 MS Access Form Design

Check Boxes Option and Toggle Check Boxes Option and Toggle ButtonsButtons

Use the check box option button or toggle button controls as stand alone Use the check box option button or toggle button controls as stand alone controls to set YesNo values When selected these controls indicate a Yes controls to set YesNo values When selected these controls indicate a Yes or True condition When cleared they indicate a No or False value or True condition When cleared they indicate a No or False value

A check box appears checked when selected and unchecked when cleared A check box appears checked when selected and unchecked when cleared An option button contains a dot when selected and is empty when cleared An option button contains a dot when selected and is empty when cleared A toggle button appears down when selected and up when clearedA toggle button appears down when selected and up when cleared Note Note These controls are most useful when bound to a YesNo field To speed These controls are most useful when bound to a YesNo field To speed

data entry use the controls DefaultValue property to make the most data entry use the controls DefaultValue property to make the most common choice the default common choice the default

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 37: 38822345 MS Access Form Design

Option GroupsOption Groups

You can use a group of option controls to present a limited set of You can use a group of option controls to present a limited set of alternatives An option group consists of a group frame that alternatives An option group consists of a group frame that contains a set of check boxes option buttons or toggle contains a set of check boxes option buttons or toggle buttons Only one option in a group can be selected at a time buttons Only one option in a group can be selected at a time (mutually exclusive choices) One value in the group can be (mutually exclusive choices) One value in the group can be set as the default Option controls used in a group have set as the default Option controls used in a group have different properties from those used stand alone In a group different properties from those used stand alone In a group each option has its each option has its Option Value Option Value property set to a number that property set to a number that indicates its value in the bound field The group frame which indicates its value in the bound field The group frame which must be created first is bound to the table field must be created first is bound to the table field Option Value Option Value properties which can only be set to numbers not text are the properties which can only be set to numbers not text are the values that are placed in the bound field when that option is values that are placed in the bound field when that option is selected selected

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 38: 38822345 MS Access Form Design

Activity 8 Create a Check Box for Paid and an Option Activity 8 Create a Check Box for Paid and an Option

Group for GenderGroup for Gender 1 Select the 1 Select the Check Box Check Box tool and click on your form tool and click on your form 2 Select the control and bring up its 2 Select the control and bring up its PropertiesProperties 3 Under the Data tab select 3 Under the Data tab select Paid Paid as the as the Control Source Control Source field field 4 Close the 4 Close the Properties Properties box box 5 Edit the label to say 5 Edit the label to say Paid FeesPaid Fees 6 Make sure the 6 Make sure the Control Wizard Control Wizard is active (button looks pushed in) is active (button looks pushed in) 7 Click on the 7 Click on the Option Group Option Group tool and draw a control box on your form tool and draw a control box on your form 8 The Wizard starts asking you questions 8 The Wizard starts asking you questions minus minus Label names type Label names type Female Female in the first row press Tab and type in the first row press Tab and type Male Male in the second row [next] in the second row [next] minus minus You You do not do not want a default choice - click the want a default choice - click the Next Next button button minus minus Use the default values of 1 and 2 - click the Use the default values of 1 and 2 - click the Next Next button button minus minus Store the value in Store the value in S-Gender S-Gender (click in the second choice and select S-Gender from the list) - click (click in the second choice and select S-Gender from the list) - click

the the Next Next button button minus minus Choose Choose Option buttons Option buttons and pick a style of your choice for the group itself - click the and pick a style of your choice for the group itself - click the Next Next

button button minus minus Specify Specify Gender Gender as the caption and click the as the caption and click the Finish Finish button button 9 Move andor resize your 2 new controls as needed 9 Move andor resize your 2 new controls as needed 10 Save your form 10 Save your form

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 39: 38822345 MS Access Form Design

Command ButtonsCommand Buttons

A command button is placed on a form to initiate an A command button is placed on a form to initiate an action To make a command button do something action To make a command button do something you need to write a macro or code module The you need to write a macro or code module The command button wizard will create some common command button wizard will create some common buttons for you and will create the underlying Access buttons for you and will create the underlying Access Visual Basic Visual Basic event code event code

1 From the toolbox select 1 From the toolbox select Control WizardsControl Wizards 2 In the toolbox click on the command button 2 In the toolbox click on the command button 3 Click on the form where you want the button placed 3 Click on the form where you want the button placed

Access will display the wizard dialog box Access will display the wizard dialog box 4 Follow the directions in the dialog box to create the 4 Follow the directions in the dialog box to create the

event code event code

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 40: 38822345 MS Access Form Design

Page BreaksPage Breaks

A page is defined as a screen in Form View or a A page is defined as a screen in Form View or a physical page on a printed form or report The physical page on a printed form or report The Page Up and Page Down keys are used to Page Up and Page Down keys are used to move past page breaks Page breaks are move past page breaks Page breaks are created by selecting the Page Break tool from created by selecting the Page Break tool from the toolbox and clicking on the form or report the toolbox and clicking on the form or report where you wish the page break to appear where you wish the page break to appear

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 41: 38822345 MS Access Form Design

NotesNotes

A page break is active in Form View only A page break is active in Form View only when the DefaultView property is set to Single when the DefaultView property is set to Single Form Form

To size a forms window so that it shows only To size a forms window so that it shows only one page choose Size To Fit Form from the one page choose Size To Fit Form from the Window menu in Form View Window menu in Form View

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 42: 38822345 MS Access Form Design

Special Design EffectsSpecial Design Effects Access contains a number of design tools on the Format toolbar and in the Access contains a number of design tools on the Format toolbar and in the

Toolbox that can add color shading lines or fonts to the form to enhance Toolbox that can add color shading lines or fonts to the form to enhance its appearance its appearance

Three dimensional appearances for controls can be created by creating the Three dimensional appearances for controls can be created by creating the control then selecting an option from the formatting tool bar control then selecting an option from the formatting tool bar

Fonts Fonts on a control can be changed by selecting the control and altering the on a control can be changed by selecting the control and altering the font information on the formatting toolbar You can also select the font information on the formatting toolbar You can also select the alignment buttons on the toolbar to position the text on the control or the alignment buttons on the toolbar to position the text on the control or the attribute buttons to boldface italicize or underline text attribute buttons to boldface italicize or underline text

Colors Colors (background foreground or border) and (background foreground or border) and Borders Borders can be set from can be set from the formatting toolbar Form controls can also be sculptured from the the formatting toolbar Form controls can also be sculptured from the rightmost button on the form design toolbar rightmost button on the form design toolbar

The The Rectangle Rectangle and and Line Line tools in the toolbox can be used to add emphasis tools in the toolbox can be used to add emphasis to important information or to isolate sections of the form to important information or to isolate sections of the form

Objects Objects (photos graphics etc) can be placed in a form by creating a box (photos graphics etc) can be placed in a form by creating a box with an with an Image Image tool or an tool or an Unbound Object Frame Unbound Object Frame tool from the toolbox If tool from the toolbox If you want different objects for different records then you must link the you want different objects for different records then you must link the object to a field in the underlying table or query object to a field in the underlying table or query

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 43: 38822345 MS Access Form Design

Calculated controlsCalculated controls

A calculated control uses an expression as its control source The A calculated control uses an expression as its control source The expression can include values from data fields other controls expression can include values from data fields other controls or constants Access does not store the result of the expression or constants Access does not store the result of the expression it recalculates it every time the form is displayed Precede the it recalculates it every time the form is displayed Precede the expression with an equal (expression with an equal (==) sign when it is placed in the ) sign when it is placed in the control source property control source property

The expression can be typed directly into the property setting The expression can be typed directly into the property setting area or it can be created in the expression builder The builder area or it can be created in the expression builder The builder can be activated by clicking on the can be activated by clicking on the Build () Build () Button Button

If you are entering the expression directly in the Control Source If you are entering the expression directly in the Control Source box press Shift F2 (zoom) if you need more room to see what box press Shift F2 (zoom) if you need more room to see what youre typing Click on OK when youre done youre typing Click on OK when youre done

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 44: 38822345 MS Access Form Design

Activity 9 - Create a Calculated Control to Activity 9 - Create a Calculated Control to compute students agecompute students age

1 Create an unbound text box control on your form 1 Create an unbound text box control on your form 2 Change the label to say 2 Change the label to say Age Age 3 Click on the data portion of the new unbound control 3 Click on the data portion of the new unbound control

and bring up its and bring up its PropertiesProperties 4 Click on the 4 Click on the Data Data tab tab 5 Next to Control Source press 5 Next to Control Source press Shift F2 Shift F2 to zoom to zoom 6 Type 6 Type =Cint((Now()-[S-BDay])365) =Cint((Now()-[S-BDay])365) and click the and click the

OK OK button button 7 Close the Properties box and switch to 7 Close the Properties box and switch to Form Form view to view to

review your results review your results 8 8 Save Save your form your form

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 45: 38822345 MS Access Form Design

SubformsSubforms

A subform is simply a form within a form The Control A subform is simply a form within a form The Control wizard has the ability to walk you through the wizard has the ability to walk you through the creation procedure creation procedure

1 In the 1 In the Design Design view of the form select the view of the form select the Control Control Wizard Wizard button from the toolbox button from the toolbox

2 Click on the 2 Click on the SubformSubreport SubformSubreport toolbox button toolbox button 3 Click and drag a rectangle on the form where the 3 Click and drag a rectangle on the form where the

subform is to appear The wizard will activate when subform is to appear The wizard will activate when the rectangle is complete the rectangle is complete

4 Respond to the questions posed by the wizard to 4 Respond to the questions posed by the wizard to complete the procedure complete the procedure

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 46: 38822345 MS Access Form Design

Activity 10 Create a Query and a Activity 10 Create a Query and a SubformSubform

1 Switch to the Queries tab and create a new query in design 1 Switch to the Queries tab and create a new query in design view view

2 Include these three tables Class Attend Student 2 Include these three tables Class Attend Student 3 Include these fields S-ID from the Student table C-Name 3 Include these fields S-ID from the Student table C-Name

Grade and Status Grade and Status 4 Save the query as StudentAttend 4 Save the query as StudentAttend 5 Return to your Student form in design mode Drag the bottom 5 Return to your Student form in design mode Drag the bottom

of the form down to get some more room of the form down to get some more room 6 Make sure the Wizard button is selected 6 Make sure the Wizard button is selected 7 Click on the FormSubform button and drag a box on top of 7 Click on the FormSubform button and drag a box on top of

your form your form 8 Wizard responses Use existing query StudentAttend Select 8 Wizard responses Use existing query StudentAttend Select

all fields Show StudentAttend for each record in Student all fields Show StudentAttend for each record in Student

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 47: 38822345 MS Access Form Design

Data Management in FormsData Management in Forms

While working in the form view some of the While working in the form view some of the common data management features such as common data management features such as sorting sorting and and filteringfiltering are available by right- are available by right-clicking on the desired field and selecting from clicking on the desired field and selecting from the shortcut menu that appears An option also the shortcut menu that appears An option also exists to remove the filter or sort and restore exists to remove the filter or sort and restore the data to its original order You can also use the data to its original order You can also use the the Find Find command (EditgtFind or Ctrl F) command (EditgtFind or Ctrl F)

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 48: 38822345 MS Access Form Design

Activity 11 Filter Sort FindActivity 11 Filter Sort Find

1 Apply a filter to display only Journalism 1 Apply a filter to display only Journalism majors Browse through the filtered records majors Browse through the filtered records Remove the filter Remove the filter

2 Sort the records by last name 2 Sort the records by last name 3 Sort the records by test score with the highest 3 Sort the records by test score with the highest

score being displayed first score being displayed first 4 Find a student whose last name begins with 4 Find a student whose last name begins with

M (hint use an advanced Filter and a M (hint use an advanced Filter and a wildcard in the criteria) Remove the filter wildcard in the criteria) Remove the filter

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 49: 38822345 MS Access Form Design

Create A Switchboard FormCreate A Switchboard Form When you use the Database Wizard to create a database the wizard creates a When you use the Database Wizard to create a database the wizard creates a

switchboard that makes it easy to navigate between the forms and reports in your switchboard that makes it easy to navigate between the forms and reports in your database If you want to build the same type of switchboard for a database you database If you want to build the same type of switchboard for a database you created yourself you can use the Switchboard Manager created yourself you can use the Switchboard Manager

1 On the 1 On the Tools Tools menu point to menu point to Database UtilitiesDatabase Utilities and then click and then click Switchboard Switchboard ManagerManager

2 If Microsoft Access asks if youd like to create a switchboard click 2 If Microsoft Access asks if youd like to create a switchboard click YesYes 3 In the 3 In the Switchboard Manager Switchboard Manager dialog box click the dialog box click the Edit Edit button to edit the default button to edit the default

Main switchboard Main switchboard 4 In the 4 In the Edit Switchboard Page Edit Switchboard Page dialog box click on dialog box click on New New to add a new item to the list to add a new item to the list

of possible actions of possible actions 5 In the 5 In the Edit Switchboard Item Edit Switchboard Item dialog box type the text for the first switchboard dialog box type the text for the first switchboard

button in the Text box and then choose a command in the Command boxbutton in the Text box and then choose a command in the Command box6 Depending on which command you click Microsoft Access displays another box 6 Depending on which command you click Microsoft Access displays another box

below the Command box Click an item in this box if necessary For below the Command box Click an item in this box if necessary For example if you chose example if you chose Open Form In Edit Mode Open Form In Edit Mode in the Command box in step 5 in the Command box in step 5 click the name of the form you want to open in the Form box such as click the name of the form you want to open in the Form box such as STUDENT STUDENT FormForm and then click the and then click the OK OK buttonbutton

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 50: 38822345 MS Access Form Design

7 Repeat steps 4 through 6 until youve added all the items to the 7 Repeat steps 4 through 6 until youve added all the items to the switchboard If you want to edit or delete an item click the switchboard If you want to edit or delete an item click the item in the item in the Items On This Switchboard Items On This Switchboard box and then click box and then click Edit Edit or or DeleteDelete If you want to rearrange items click the item If you want to rearrange items click the item in the box and then click in the box and then click Move Up Move Up or or Move DownMove Down

8 Click 8 Click CloseClose 9 Look for your Switchboard under the Forms tab 9 Look for your Switchboard under the Forms tab 10 You can edit it in design view to change the text colors etc 10 You can edit it in design view to change the text colors etc

Be careful do not edit or delete the Switchboard table which Be careful do not edit or delete the Switchboard table which controls your options on this form controls your options on this form

11 You can make the Switchboard open automatically when the 11 You can make the Switchboard open automatically when the database is opened can (and optionally make it the only way database is opened can (and optionally make it the only way into the database objects) by going to the into the database objects) by going to the Tools Tools menu and menu and selecting selecting StartupStartup

12 Change 12 Change Display Form Display Form to to SwitchboardSwitchboard 13 Uncheck 13 Uncheck Display Database Window Display Database Window if you dont want other if you dont want other

users to see itusers to see it

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano

Page 51: 38822345 MS Access Form Design

Thank YouThank You SY 2010-2011 SY 2010-2011

This Slide was Prepared by the Aim-Aop II-A Group IIThis Slide was Prepared by the Aim-Aop II-A Group II

Member ListMember List

Homer CruzHomer Cruz Maricar SabadoMaricar Sabado

Donna Lyza PringDonna Lyza Pring Katrin GimpayaKatrin Gimpaya

Aira BabatioAira Babatio Juvy Ann MalitJuvy Ann Malit

Justin GarciaJustin Garcia Roldan Remy LopezRoldan Remy Lopez

Arjan EbuengaArjan Ebuenga Dale Myron De LeonDale Myron De Leon

Jan Kris Vergel De DiosJan Kris Vergel De Dios Vanessa April OrainVanessa April Orain

Paulo SerranoPaulo Serrano