shelly cashman: microsoft access 2016people.uncw.edu/mferner/cit213/scslides/m08.pdf · 2 © 2017...
TRANSCRIPT
1
Shelly Cashman: Microsoft Access 2016Module 8: Macros, Navigation Forms, and Control Layouts
© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or
otherwise on a password-protected website for classroom use.
2© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Objectives
• Create and modify macros and submacros
• Create a menu form with command buttons
• Use an IF statement in a macro
• Create navigation forms
• Add tabs to a navigation form
• Create and remove control layouts
• Use the Arrange tab to modify control layouts on forms and reports
3© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Macros
• A collection of actions which carry out a specific task
• Running a macro makes the actions execute
• Examples• Open a form in read-only mode (to prevent changes to data)• Export a report file as a PDF• User Interface (UI) Macros: actions associated with a
command button• Data Macros add logic to table events
4© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Creating and Using Macro
• To Begin Creating a Macro• Click the Macro button to create a new macro
5© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Creating and Using Macro
• To Add an Action to a Macro• 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
• Click the expand indicator for the Database Objects category of actions to display the actions within the category
• Double-click the desired action to add it to the submacro• Change the arguments as desired• Click the Save button on the Quick Access Toolbar, type the
desired macro name, and then Click the OK button to save the macro
6© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Creating and Using a Navigation Form
• To Create a Navigation Form• Click the Navigation button to display the menu of available
navigation forms• 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, click the ‘Add Existing Fields’ button to remove the field list
• Save the form using the desired name• 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
7© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Creating and Using a Navigation Form
• To Add Tabs to a Navigation Form• Drag the form to the desired position to add a new tab• To rename a tab, 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
8© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Creating and Using a Navigation Form
• To Create a Menu Form Containing Command Buttons• Click the Form Design button to create a blank form in Design
view• If a field list appears, click the ‘Add Existing Fields’ button to
remove the field list• Make sure the ‘Use Control Wizards’ button is selected• Click the Button tool and then click the desired position to
display the Command Button Wizard dialog box• Click Miscellaneous in the Categories box, and then click Run
Macro in the Actions box
9© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Creating and Using a Navigation Form
• To Create a Menu Form Containing Command Buttons, continued• Click the Next button to display the next screen in the wizard• Click the desired macro to run• Click the Next button to display the next Command Button
Wizard screen• Click the Text option button• Type the desired text to appear on the button• Click the Next button• Type the desired button name• Click the Finish button to finish specifying the button
10© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Creating and Using a Navigation Form
Using an If Statement
11© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Creating and Using a Navigation Form
• To Add Actions to the Form Options Macro• Double-click the element from the desired section of the
Action Catalog
12© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Creating and Using a Navigation Form
• To Create UI Macros for the Datasheet Forms• Open the desired form• Click the desired column heading• If necessary, click the Property sheet button to display a
property sheet• Click the Event tab to display only event properties• Click the desired event and then click the Build button to
display the Choose Builder dialog box• Click the OK button to display the Macro Builder window• Add the desired actions to the macro• Click the Save button to save the macro
13© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Using Control Layouts on Forms and Reports
• To Create a Layout for a Form or Repot• Select all the controls that you want to place in a layout• Click the Stacked button to create a stacked layout or the
Tabular button to create a tabular layout
• To Remove a Layout for a Form or Report• 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 click Remove
Layout on the submenu to remove the layout
14© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Using Control Layouts on Forms and Reports
• To Insert a Row• Select any control in the row above or below where you want to
insert a new row• Click the Select Row button to select the row.• Click the Insert Above button to insert a blank row above the
selected row or the Insert Below button to insert a blank row below the selected row
• To Insert a Column• Select any control in the column to the right or left of where you
want to insert a new column• Click the Select Column button to select the column• Click the Insert Left button to insert a blank column to the left of the
selected column or the Insert Right button to insert a blank column to the right of the selected column
15© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Using Control Layouts on Forms and Reports
• To Delete a Row• Click any control in the row you want to delete• Click Select Row • Press the DELETE key to delete the row
• To Delete a Column• Click any control in the column you want to delete• Click Select Column • Press the DELETE key to delete the column
16© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Using Control Layouts on Forms and Reports
• To Split a Cell• Click the cell to be split• Click the Split Vertically button to split the selected cell
vertically or the Split Horizontally button to split the selected cell horizontally
• To Merge a Cell• Select the first cell to be merged• While holding down the CTRL key, click all the other cells to be
merged• Click the Merge button to merge the cells
17© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Using Control Layouts on Forms and Reports
• To Change Control Margins• Select any cell in the layout• Click the Select Layout button to select the entire layout. (You
also can select the layout by clicking the layout selector.)• Click the Control Margins button to display the available
margin settings• Click the desired margin setting
• To Change Control Padding• Select the layout• Click the Control Padding button to display the available
padding settings• Click the desired padding setting
18© 2017 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or
in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Using Control Layouts on Forms and Reports
• To Split a Layout• Select all the cells that you want to move to a new layout• Click the Stacked button to place the cells in a stacked layout
or the Tabular button to place the cells in a tabular layout
• To Anchor Controls• Select the control or controls to be anchored• Click the Anchoring button to produce the Anchoring gallery• Select the desired Anchoring option from the Anchoring gallery