access2013 ch08

51
Chapter 8 Macros, Navigation Forms, and Control Layouts Microsoft Access 2013

Upload: kristin-harrison

Post on 12-Jul-2015

163 views

Category:

Education


0 download

TRANSCRIPT

Chapter 8

Macros, Navigation Forms, and Control

Layouts

Microsoft

Access 2013

• Create and modify macros and submacros

• Create a menu form with command buttons

• Create a menu form with an option group

• Create a macro for the option group

• Use an IF statement in a macro

• Create datasheet forms

Macros, Navigation Forms, and Control Layouts 2

Objectives

• Create user interface (UI) macros

• Create navigation forms

• Add tabs to a navigation form

• Create data macros

• Create and remove control layouts

• Use the ARRANGE tab to modify control layouts on forms and reports

Macros, Navigation Forms, and Control Layouts 3

Objectives

Macros, Navigation Forms, and Control Layouts 4

Project – Macros, Navigation Forms, and

Control Layouts

Macros, Navigation Forms, and Control Layouts 5

Project – Macros, Navigation Forms, and

Control Layouts

Macros, Navigation Forms, and Control Layouts 6

Project – Macros, Navigation Forms, and

Control Layouts

Macros, Navigation Forms, and Control Layouts 7

Project – Macros, Navigation Forms, and

Control Layouts

• Create and modify a macro with submacros

• Create a menu form with command buttons

• Create a menu form with an option group

• Create a macro for the option group

• Create datasheet forms

• Create user interface (UI) macros

• Create a navigation form

• Create a data macro

Macros, Navigation Forms, and Control Layouts 8

Roadmap

• Tap or click the Macro button (CREATE tab | Macros & Code group) to create a new macro

Macros, Navigation Forms, and Control Layouts 9

Begin Creating a Macro

• Double-tap or double-click the Submacro element from the Program Flow section of the Action Catalog to add a second submacro and then type the desired submacro name

• Tap or click the expand indicator for the Database Objects category of actions to display the actions within the category

• Double-tap or double-click the desired action to add it to the submacro

• Change the arguments as desired

• Tap or click the Save button on the Quick Access Toolbar, type the desired macro name, and then tap or click the OK button to save the macro

Macros, Navigation Forms, and Control Layouts 10

Adding an Action to a Macro

Macros, Navigation Forms, and Control Layouts 11

Adding an Action to a Macro

• Tap or click the Form Design button (CREATE tab | Forms group) to create a blank form in Design view

• If a field list appears, tap or click the ‘Add Existing Fields’ button (FORM DESIGN TOOLS DESIGN tab | Tools group) to remove the field list

• Make sure the ‘Use Control Wizards’ button is selected

• Tap or click the Button tool (FORM DESIGN TOOLS DESIGN tab | Controls group) and then tap or click the desired position to display the Command Button Wizard dialog box

• Tap or click Miscellaneous in the Categories box, and then tap or click Run Macro in the Actions box

Macros, Navigation Forms, and Control Layouts 12

Creating a Menu Form Containing

Command Buttons

• Tap or click the Next button to display the next screen in the wizard

• Tap or click the desired macro to run• Tap or click the Next button to display the next

Command Button Wizard screen• Tap or click the Text option button• Type the desired text to appear on the button• Tap or click the Next button• Type the desired button name• Tap or click the Finish button to finish specifying the

button

Macros, Navigation Forms, and Control Layouts 13

Creating a Menu Form Containing

Command Buttons

Macros, Navigation Forms, and Control Layouts 14

Creating a Menu Form Containing

Command Buttons

• Tap or click the Form Design button (CREATE tab | Forms group) to create a blank form in Design view

• If a field list appears, tap or click the ‘Add Existing Fields’ button (FORM DESIGN TOOLS DESIGN tab | Tools group) to remove the field list

• Tap or click the Option Group tool (FORM DESIGN TOOLS DESIGN tab | Controls group) and then tap or click the desired location to start the Option Group Wizard

Macros, Navigation Forms, and Control Layouts 15

Creating a Menu Form

Containing an Option Group

• Type the name for each label in its own row, pressing the DOWN ARROW after each label name

• Tap or click the Next button to move to the next Option Group Wizard screen

• Tap or click the ‘No, I don’t want a default’ option button to select it

• Tap or click the Next button to move to the next Option Group Wizard screen and then verify that the values assigned to the labels

Macros, Navigation Forms, and Control Layouts 16

Creating a Menu Form

Containing an Option Group

• Tap or click the Next button to move to the next Option Group Wizard screen, and then select the desired style

• Tap or click the Next button to move to the next Option Group Wizard screen and then type the desired caption

• Tap or click the Finish button to complete the addition of the option group

Macros, Navigation Forms, and Control Layouts 17

Creating a Menu Form

Containing an Option Group

Macros, Navigation Forms, and Control Layouts 18

Creating a Menu Form

Containing an Option Group

Macros, Navigation Forms, and Control Layouts 19

Using an If Statement

• With the option group selected, display a property sheet

• If necessary, tap or click the All tab

• Change the name of the option group as desired

• Tap or click the After Update property

• Tap or click the Build button to display the Choose Builder dialog box

• With Macro Builder selected in the Choose Builder dialog box, tap or click the OK button to create a macro

Macros, Navigation Forms, and Control Layouts 20

Creating a Macro with a Variable for an

Option Group

• If necessary, tap or click the Action Catalog button (MACRO TOOLS DESIGN tab | Show/Hide group) to display the Action Catalog

• Expand the desired category

• Double-tap or double-click the desired action to add the action to the macro

• Type the desired Name argument and Expression argument

Macros, Navigation Forms, and Control Layouts 21

Creating a Macro with a Variable for an

Option Group

Macros, Navigation Forms, and Control Layouts 22

Creating a Macro with a Variable for an

Option Group

• Double-tap or double-click the element from the desired section of the Action Catalog

Macros, Navigation Forms, and Control Layouts 23

Adding Actions to a Macro

Macros, Navigation Forms, and Control Layouts 24

Adding Actions to a Macro

• Open the desired form• Tap or click the desired column heading• If necessary, tap or click the Property sheet button (FORM

TOOLS DATASHEET tab | Tools group) to display a property sheet• Tap or click the Event tab to display only event properties• Tap or click the desired event and then tap or click the Build

button to display the Choose Builder dialog box• Tap or click the OK button to display the Macro Builder window• Add the desired actions to the macro• Tap or click the Save button (MACRO TOOLS DESIGN tab | Close

group) to save the macro

Macros, Navigation Forms, and Control Layouts 25

Creating UI Macros

for the Datasheet Forms

Macros, Navigation Forms, and Control Layouts 26

Creating UI Macros

for the Datasheet Forms

• Tap or click the Navigation button (CREATE tab | Forms group) to display the menu of available navigation forms

• Tap or click Horizontal Tabs in the gallery to create a form with a navigation control in which the tabs are arranged horizontally in a single row

• If a field list appears, tap or click the ‘Add Existing Fields’ button (FORM LAYOUT TOOLS DESIGN tab | Tools group) to remove the field list

• Save the form using the desired name• Tap or click the form title twice: once to select it and the

second time to produce an insertion point• Type the desired title, and then save the form

Macros, Navigation Forms, and Control Layouts 27

Creating a Navigation Form

Macros, Navigation Forms, and Control Layouts 28

Creating a Navigation Form

• Drag the form to the desired position to add a new tab

• To rename a tab, tap or click the tab to rename twice: one to select it and the second time to produce an insertion point

• Change the tab name as desired

Macros, Navigation Forms, and Control Layouts 29

Adding Tabs to a Navigation Form

Macros, Navigation Forms, and Control Layouts 30

Adding Tabs to a Navigation Form

Macros, Navigation Forms, and Control Layouts 31

Creating a Data Macro

• Select all the controls that you want to place in a layout

• Tap or click the Stacked button (FORM LAYOUT TOOLS ARRANGE tab | Table group) to create a stacked layout or the Tabular button (FORM LAYOUT TOOLS ARRANGE tab | Table group) to create a tabular layout

Macros, Navigation Forms, and Control Layouts 32

Creating a Layout for a Form or Report

• Press and hold or right-click any control in the layout you want to remove to produce a shortcut menu

• Point to Layout on the shortcut menu and then tap or click Remove Layout on the submenu to remove the layout

Macros, Navigation Forms, and Control Layouts 33

Removing a Layout for a Form or Report

• Select any control in the row above or below where you want to insert a new row

• Tap or click the Select Row button (FORM LAYOUT TOOLS ARRANGE tab | Rows & Columns group) to select the row.

• Tap or click the Insert Above button (FORM LAYOUT TOOLS ARRANGE tab | Rows & Columns group) to insert a blank row above the selected row or the Insert Below button (FORM LAYOUT TOOLS ARRANGE tab | Rows & Columns group) to insert a blank row below the selected row

Macros, Navigation Forms, and Control Layouts 34

Inserting a Row

Macros, Navigation Forms, and Control Layouts 35

Inserting a Row

• Select any control in the column to the right or left of where you want to insert a new column

• Tap or click the Select Column button (FORM LAYOUT TOOLS ARRANGE tab | Rows & Columns group) to select the column

• Tap or click the Insert Left button (FORM LAYOUT TOOLS ARRANGE tab | Rows & Columns group) to insert a blank column to the left of the selected column or the Insert Right button (FORM LAYOUT TOOLS ARRANGE tab | Rows & Columns group) to insert a blank column to the right of the selected column

Macros, Navigation Forms, and Control Layouts 36

Inserting a Column

• Tap or click any control in the row you want to delete

• Tap or click Select Row (FORM LAYOUT TOOLS ARRANGE tab | Rows & Columns group)

• Press the DELETE key to delete the row

Macros, Navigation Forms, and Control Layouts 37

Deleting a Row

• Tap or click any control in the column you want to delete

• Tap or click Select Column (FORM LAYOUT TOOLS ARRANGE tab | Rows & Columns group)

• Press the DELETE key to delete the column

Macros, Navigation Forms, and Control Layouts 38

Deleting a Column

• Tap or click the cell to be split

• Tap or click the Split Vertically button (FORM LAYOUT TOOLS ARRANGE tab | Merge / Split group) to split the selected cell vertically or the Split Horizontally button (FORM LAYOUT TOOLS ARRANGE tab | Merge / Split group) to split the selected cell horizontally

Macros, Navigation Forms, and Control Layouts 39

Splitting a Cell

• Select the first cell to be merged

• While holding down the CTRL key, tap or click all the other cells to be merged

• Tap or click the Merge button (FORM LAYOUT TOOLS ARRANGE tab | Merge / Split group) to merge the cells

Macros, Navigation Forms, and Control Layouts 40

Merging Cells

• Select any cell in the row to be moved

• Tap or click the Select Row button (FORM LAYOUT TOOLS ARRANGE tab | Rows & Columns group) to select the entire row

• Tap or click the Move Up button (FORM LAYOUT TOOLS ARRANGE tab | Move group) to move the selected row up one row or the Move Down button (FORM LAYOUT TOOLS ARRANGE tab | Move group) to move the selected row down one row

Macros, Navigation Forms, and Control Layouts 41

Moving Rows Using the Move Buttons

• Select any cell in the layout

• Tap or click the Select Layout button (FORM LAYOUT TOOLS ARRANGE tab | Rows & Columns group) to select the entire layout. (You also can select the layout by tapping or clicking the layout selector.)

• Tap or click the Control Margins button (FORM LAYOUT TOOLS ARRANGE tab | Position group) to display the available margin settings

• Tap or click the desired margin setting

Macros, Navigation Forms, and Control Layouts 42

Changing Control Margins

• Select the layout

• Tap or click the Control Padding button (FORM LAYOUT TOOLS ARRANGE tab | Position group) to display the available padding settings

• Tap or click the desired padding setting

Macros, Navigation Forms, and Control Layouts 43

Changing Control Padding

• Select all the cells that you want to move to a new layout

• Tap or click the Stacked button (FORM LAYOUT TOOLS ARRANGE tab | Table group) to place the cells in a stacked layout or the Tabular button (FORM LAYOUT TOOLS ARRANGE tab | Table group) to place the cells in a tabular layout

Macros, Navigation Forms, and Control Layouts 44

Splitting a Layout

• Tap or click any cell in the layout to be moved and then tap or click the Select Layout button (FORM LAYOUT TOOLS ARRANGE tab | Rows & Columns group) to select the layout

• Drag the layout to the new location

Macros, Navigation Forms, and Control Layouts 45

Moving a Layout

• Select the control or controls to be anchored

• Tap or click the Anchoring button (FORM LAYOUT TOOLS ARRANGE tab | Position group) to produce the Anchoring gallery

• Select the desired Anchoring option from the Anchoring gallery

Macros, Navigation Forms, and Control Layouts 46

Anchoring Controls

• Tap or click FILE on the ribbon to open the Backstage view

• Tap or click Options to display the Access Options dialog box

• Tap or click Current Database to display the Current Database options

• In the Application Options area, tap or click the Overlapping Windows option button

Macros, Navigation Forms, and Control Layouts 47

Displaying Objects in Overlapping

Windows

• Tap or click FILE on the ribbon to open the Backstage view

• Tap or click Options to display the Access Options dialog box

• Tap or click Current Database to display the Current Database options

• In the Application Options area, tap or click the Tabbed Documents option button

• Tap or click the OK button to close the Access Options dialog box

• For the changes to take effect, you will need to close and then reopen the database

Macros, Navigation Forms, and Control Layouts 48

Displaying Objects in Tabbed Documents

• Create and modify macros and submacros

• Create a menu form with command buttons

• Create a menu form with an option group

• Create a macro for the option group

• Use an IF statement in a macro

• Create datasheet forms

Macros, Navigation Forms, and Control Layouts 49

Chapter Summary

• Create user interface (UI) macros

• Create navigation forms

• Add tabs to a navigation form

• Create data macros

• Create and remove control layouts

• Use the ARRANGE tab to modify control layouts on forms and reports

Macros, Navigation Forms, and Control Layouts 50

Chapter Summary

Chapter 8 Complete

Microsoft

Access 2013