SlideShare a Scribd company logo
Automating Database ProcessingSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 1Chapter 6“An organization’s ability to learn, and translate that learninginto action rapidly, is the ultimate competitive advantage.”—Jack Welch
Chapter IntroductionDesign and implement user-friendly menuCalled switchboardMacrosAutomate repetitive tasksConditionsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 2
Tools Covered in This ChapterAutoExec macroAutoKeys macroMacro windowStartup dialog boxSwitchboard ManagerSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 3
Level 1 Objectives: Automating Tasks with Switchboards and MacrosCreate a well-designed switchboard to provide a user interface for a databaseAutomate tasks by creating basic macrosSpecify what happens when a database opensSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 4
Understanding SwitchboardsSwitchboard Special kind of form Appears when database openedLists options for working with database objectsSelect up to eight objects to list on switchboardDetermine what action Access should take when users select optionSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 5
Understanding Switchboards (continued)Typical switchboard buttonsOpen forms reports and other objects Open other switchboards that list additional database objects Close switchboardOpen the Navigation PaneClose AccessMain switchboardLarge number of database objectsLaunches other switchboardsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 6
Typical Switchboard DesignSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 7
Designing a SwitchboardSwitchboard ManagerTool to design and customize switchboardCreate main switchboardAdd buttonsSpecify button propertiesAccess creates switchboard formOnly one switchboard per databaseCan contain many pagesSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 8
Creating a Switchboard Open Switchboard ManagerSwitchboard Manager dialog boxUse five buttons on Switchboard Manager dialog box to perform tasksCreate secondary switchboards firstVerify new form creationSwitchboard item table Keeps track of switchboard items commands and arguments Should be altered only through Switchboard ManagerSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 9
Switchboard Manager ButtonsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 10
Edit Switchboard Item Dialog BoxSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 11
Switchboard CommandsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 12
Formatting a SwitchboardBy default Access switchboards share same layout and design Including background colors and placement of titleSwitchboard Manager doesn’t provide options for modifying switchboard designFormat switchboard in form design viewDo not change command buttons or propertiesSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 13
Understanding Basic MacrosMacro Action or series of actions Save time and ensure accuracyUsually assigned to key, key combination, or buttonComposed of series of actions organized in sequence in which they should be performedCreate macroUsing Macro windowSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 14
Common Macro ActionsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 15
Creating a MacroCreate Access macro in Macro windowSelect the Create tab, and then click the Macro button in the Other groupAction column List actions macro performsClick list arrow in action columnAccess provides over 50 different actionsComment columnDocument action by describing what task it performsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 16
Creating a Macro (continued)Action arguments paneProvide additional information for performing macro actionArguments needed vary depending on selected action chosenSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 17
Running a MacroIn Macro window Click the Run button in the Design tabClick Run Macro on the Database Tools Ribbon, click the list arrow and select the macro, and then click OKIn the Navigation Pane, click Macros, right-click the macro name, and then click RunSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 18
Macro Design ToolbarSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 19
Editing a MacroUse Macro windowRearrange order of actions Drag action line to new positionInsert new action between two existing actions Right-click row Click insert rowsDelete actionRight-click row Click delete rowsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 20
Setting Startup OptionsStartup optionsAccess performs when database opensUse Startup dialog boxBypass Startup OptionsPress and hold down shift key when opening databaseSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 21
Specifying Startup Options in the Startup Dialog BoxOptionsDisplay formDisplay navigation paneAllow full menusSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 22
Startup Dialog BoxSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 23
Creating a Splash ScreenSplash screenDisplays when database opensContainsLogoTextCan only display splash screen or switchboard automaticallySucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 24
Creating a Splash Screen (continued)AutoExecSpecial macroRuns when database opensBefore startup dialog box optionsCan use to display splash screenCreate splash screen formSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 25
Creating an AutoExec MacroCreate macro that contains actions Access should perform when database openedSave macro using name AutoExecSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 26
Level 1 SummarySwitchboard Special kind of form Appears when database openedMacroUse to automate repeated actionsStartup options dialog boxSplash screenSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 27
Level 2 Objectives:Creating Advanced MacrosConsolidate automated tasks by creating a macro groupCreate buttons that can perform a series of actionsTroubleshoot macrosSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 28
Understanding Macro GroupsMacro group Two or more macros placed within same macro fileConsolidate related macros Manage large numbers of macrosOnly group name displayed as macro object in database windowSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 29
Creating a Macro GroupLogical to organize similar macros within groupTo create Click the Create tab and then click the Macro buttonClick the Macro Names button on the Design tab. Access adds the Macro Name column to the left of the Action columnIn the Macro Name column, enter the name of a macroIn the Action column, enter the corresponding actions for the macroEnter comments as needed in the Comment column, and set arguments as needed in the Action Arguments paneSave the macro group, using the “mcr” prefix in the object nameSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 30
Running the Macros in a Macro GroupRun particular macro within groupClick the Run Macro button in the Macro group on the Database Tools RibbonSelect the list arrow to choose the macro nameClick the macro nameClick OKSwitchboard Manager and many property sheetsSpecify name of macro to runSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 31
Running the Macros in a Macro GroupRun macro objectEnter or select nameRun only one macro in macro groupUse special notation mcrGroupName.mcrMacroNameSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 32
Creating an AutoKeys Macro GroupAutoKeys macro group Assign macro action or set of actions to key or key combinationMacro name columnType key or key combination Use special syntaxSendKeys action Sends keystrokes to Access or to another active programSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 33
Examples of Key Combinations for the Autokeys Macro GroupSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 34
Modifying the Switchboard to Run MacrosModify switchboard to include Macro group listing macros that open queriesSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 35
Specifying Conditions and Events for MacrosSpecify conditions for performing macro actions Assign macro to controlEvent-driven programmingRunning macro when user interacts with objectEvent State condition or occurrence that Access recognizesEvent propertySpecifies how object responds when event occursSet to macro name to run macro when even occursSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 36
Assigning a Macro to a ControlCreate macro or macro group that performs series of actionsAssign macro to controlAdd command button to form by opening form in Design viewAttach macro with desired actions to command buttonUsing On Click propertySucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 37
Specifying Conditions in a MacroWhere condition argumentRefer to controls on form that are not currently activeUse control’s complete nameFormat[Forms]![formName]![controlName]Succeeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 38
Troubleshooting MacrosMacros containing argumentsEspecially error proneError typesSyntax errorLogic errorRun-time errorTroubleshooting toolsSingle step through execution of macro, using debug windowPrint macro codeSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 39
Printing MacrosOpen Documenter dialog box Select macroClick options button to select details of macro to printSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 40
Single Stepping a MacroRuns macro one action at time Pausing between actionsMake sure actions appear in correct order and with correct argumentsUse Single Step buttonMacro Single Step dialog boxButtonsStepHaltContinueSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 41
Using Breakpoints and the Debug WindowBreakpointCode inserted in macroSignals where to stop macroExamine values of actions controls, and arguments macro using in debug windowDebug window Shows macro as it appears in VBA codeExamine details of macro code in debug windowSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 42
Using Breakpoints and the Debug Window (continued)Immediate paneDisplays current value of controls and argumentsDisplay using ? operatorSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 43
Level 2 SummaryMacro groupConditions for macrosAssign macro to controlDebug macrosSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 44
Level 3 Objectives:Macro ConditionsDisplay message boxes under specified conditionsRun a macro when a form opens or a report printsUse a macro to validate dataSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 45
Exploring Macro ConditionsMacro conditions Logical expressions that result in true or false answerDepending on outcome Macro can perform one set of actions or anotherEnter macro conditions Open condition column in Macro windowBy clicking Conditions buttonIf condition true Access performs corresponding action in action columnSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 46
Exploring Macro ConditionsPerform more than one action if condition true Enter conditional statement in condition column Select actions in action column in order Enter ellipsis (…) for each subsequent action associated with condition in condition columnSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 47
Exploring Macro Conditions (continued)SetValue actionChange property of object by disabling, updating, hiding, or displaying controlArguments ItemExpressionSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 48
Assigning a Macro to an Object EventAssign macro to object By specifying macro name in event property of objectEvent categoriesReportSectionSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 49
Report EventsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 50
Report Section EventsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 51
Using Message Boxes with FormsForm events can also trigger macrosUse to Validate data Set values Navigate between formsFilter, find, and print recordsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 52
Form EventsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 53
Using Message Boxes with FormsMsgBox commandOpens message box Displays warning or informational messageMsgBox ("message" sum of button and icon values "title")Returns value depending on which button clickedCreate condition that checks to see which button users clickSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 54
Using Message Boxes with ReportsWhen conditions in macro references name of control from source Source must be open when condition testedCan hide window while macro tests conditionMsgBox actionOpens message box and displays warning or informational messageSimilar to using MsgBox commandSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 55
Using Message Boxes with Reports (continued)MsgBox action arguments Message Beep TypeTitleSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 56
Validating Data with MacrosValidation field properties have limitsValidate data using more than one rule and more than one validation messageCreate macroDomain aggregate functionsCalculate statistics for set of records (recordset) or domain, from table or queryDcount functionDcount(expression, table or query, condition)Succeeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 57
Common Domain Aggregate FunctionsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 58
Level 3 SummaryConditional expressions in macrosAssign macros to eventsMessage boxesMsgbox commandMsgbox actionValidate data with macrosSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 59
Chapter SummarySwitchboardProvides main menu for Access applicationMacro Automates repetitive tasksCan use conditional expressionsAssociate with command buttons or other controlsDebuggerFind errors in macros by stepping though each statementSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 60

More Related Content

PPTX
Ch01 Access
 
PPTX
Ch07 Access
 
PPTX
Ch04 Access
 
PPTX
Ch05 Access
 
PPTX
Ch02 Access
 
PPTX
Intro Access
 
PPTX
Ch03 Access
 
PPTX
Access 2013 Unit C
Ch01 Access
 
Ch07 Access
 
Ch04 Access
 
Ch05 Access
 
Ch02 Access
 
Intro Access
 
Ch03 Access
 
Access 2013 Unit C

What's hot (18)

PPT
Power Point Unit C
PDF
Sample sales reengineering in obiee 11g part i and part ii
PPT
Excel 2007 Unit A
PPTX
Access lesson05
DOC
Template builder for word tutorial
PPTX
PowerPoint Unit A
PPTX
Access 2013 Unit B
PPT
Access 2007 Unit B
PPTX
Excel 2013 Unit A
PPTX
Access lesson 04 Creating and Modifying Forms
PDF
Fomatting Text Tips
PDF
Microsoft excel 2013 Quickstart
PPT
Unit C - CSCI 64
 
PPTX
Excel 2013 Unit C
PPTX
TimeCard for Outlook - Workgroup version
PPTX
Microsoft Dynamics CRM - Customization and Configuration Training Online Cour...
DOCX
Document Generation in Dynamics CRM 2016
PPT
Access.05
Power Point Unit C
Sample sales reengineering in obiee 11g part i and part ii
Excel 2007 Unit A
Access lesson05
Template builder for word tutorial
PowerPoint Unit A
Access 2013 Unit B
Access 2007 Unit B
Excel 2013 Unit A
Access lesson 04 Creating and Modifying Forms
Fomatting Text Tips
Microsoft excel 2013 Quickstart
Unit C - CSCI 64
 
Excel 2013 Unit C
TimeCard for Outlook - Workgroup version
Microsoft Dynamics CRM - Customization and Configuration Training Online Cour...
Document Generation in Dynamics CRM 2016
Access.05
Ad

Viewers also liked (20)

PPT
Chapter 19 Ppt19
 
PPT
Chapter 17 Intro To Controlling Ppt17
 
PPT
Chapter 14 Managers And Communication Ppt14
 
PPT
Chapter 7 Foundations Of Planning Ppt07
 
PPT
Chapter 18 Managing Operations Ppt18
 
PPT
What is an organizational chart?
PPT
Chapter 13 Understanding Individual Behavior Ppt13
 
PPT
Chapter 15 Motivating Employees Ppt15
 
PPT
Chapter 12 Human Resource Management Ppt12
 
DOC
Communication skills in english
PPTX
Monte Carlo Simulation
PPTX
Access lesson 06 Integrating Access
PDF
Monte Carlo G P U Jan2010
PPTX
Database and Access Power Point
PDF
Lecture1
PDF
OWASP Khartoum Cyber Security Session
PPTX
Access lesson 02 Creating a Database
PDF
Monte Carlo Statistical Methods
PPT
01 computer%20 forensics%20in%20todays%20world
PPT
Computer Forensics & Windows Registry
Chapter 19 Ppt19
 
Chapter 17 Intro To Controlling Ppt17
 
Chapter 14 Managers And Communication Ppt14
 
Chapter 7 Foundations Of Planning Ppt07
 
Chapter 18 Managing Operations Ppt18
 
What is an organizational chart?
Chapter 13 Understanding Individual Behavior Ppt13
 
Chapter 15 Motivating Employees Ppt15
 
Chapter 12 Human Resource Management Ppt12
 
Communication skills in english
Monte Carlo Simulation
Access lesson 06 Integrating Access
Monte Carlo G P U Jan2010
Database and Access Power Point
Lecture1
OWASP Khartoum Cyber Security Session
Access lesson 02 Creating a Database
Monte Carlo Statistical Methods
01 computer%20 forensics%20in%20todays%20world
Computer Forensics & Windows Registry
Ad

Similar to Ch06 Access (20)

PPTX
Ch06 cmpt110
PPT
AIA101.4.Automating Access
PPT
Excel 2007 Unit P
PPT
Excel 2007 Unit I
PPTX
Using macros in microsoft access
PDF
VT University Live Session 3
PPTX
Ch07 cmpt110
PPT
It203 class slides-unit5
PPT
Access 2 day course
PDF
MS Access Macros
PPT
Access2007 Getuptospeed
PPTX
How To Open The Form View Of Many2many Clicking Tag In Odoo 18
PPT
Spreadsheet Analytical Tools
PPSX
TFI Leverage Excel 2007 (QAT) 011310
PPTX
Vb6.0 intro
PPT
SharePoint Project Phase 3 to 4
PPTX
Excel ch10
PPTX
Whats new in visual studio 2017
PDF
Intake 37 9
Ch06 cmpt110
AIA101.4.Automating Access
Excel 2007 Unit P
Excel 2007 Unit I
Using macros in microsoft access
VT University Live Session 3
Ch07 cmpt110
It203 class slides-unit5
Access 2 day course
MS Access Macros
Access2007 Getuptospeed
How To Open The Form View Of Many2many Clicking Tag In Odoo 18
Spreadsheet Analytical Tools
TFI Leverage Excel 2007 (QAT) 011310
Vb6.0 intro
SharePoint Project Phase 3 to 4
Excel ch10
Whats new in visual studio 2017
Intake 37 9

More from D (15)

PPT
Chapter 10 Organizational Structure And Design Ppt10
 
PPT
Chapter 11 Communication And Information Technology Ppt11
 
PPT
Chapter 9 Planning Tools Techniques Ppt09
 
PPT
Chapter 8 Strategic Management Ppt08
 
PPT
Chapter 6 Decision Making The Essence Of The Managers Job Ppt06
 
PPT
Chapter 5 Social Responsibility And Managerial Ethics Ppt05
 
PPT
Chapter 4 Managing In A Global Environmen Ppt04
 
PPT
Chapter 3 Organiz Culture And Environ The Constraints Ppt03
 
PPT
Chapter 2 Management Yesterday And Today Ppt02
 
PPT
Stu R C8e Ch06
 
PPT
Stu R C8e Ch15
 
PPT
Stu R C8e Ch15 11
 
PPT
Stu R C8e Ch 13
 
PPT
Stu R C8e Ch13 12
 
PPT
Stu R C8e Ch12 10
 
Chapter 10 Organizational Structure And Design Ppt10
 
Chapter 11 Communication And Information Technology Ppt11
 
Chapter 9 Planning Tools Techniques Ppt09
 
Chapter 8 Strategic Management Ppt08
 
Chapter 6 Decision Making The Essence Of The Managers Job Ppt06
 
Chapter 5 Social Responsibility And Managerial Ethics Ppt05
 
Chapter 4 Managing In A Global Environmen Ppt04
 
Chapter 3 Organiz Culture And Environ The Constraints Ppt03
 
Chapter 2 Management Yesterday And Today Ppt02
 
Stu R C8e Ch06
 
Stu R C8e Ch15
 
Stu R C8e Ch15 11
 
Stu R C8e Ch 13
 
Stu R C8e Ch13 12
 
Stu R C8e Ch12 10
 

Ch06 Access

  • 1. Automating Database ProcessingSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 1Chapter 6“An organization’s ability to learn, and translate that learninginto action rapidly, is the ultimate competitive advantage.”—Jack Welch
  • 2. Chapter IntroductionDesign and implement user-friendly menuCalled switchboardMacrosAutomate repetitive tasksConditionsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 2
  • 3. Tools Covered in This ChapterAutoExec macroAutoKeys macroMacro windowStartup dialog boxSwitchboard ManagerSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 3
  • 4. Level 1 Objectives: Automating Tasks with Switchboards and MacrosCreate a well-designed switchboard to provide a user interface for a databaseAutomate tasks by creating basic macrosSpecify what happens when a database opensSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 4
  • 5. Understanding SwitchboardsSwitchboard Special kind of form Appears when database openedLists options for working with database objectsSelect up to eight objects to list on switchboardDetermine what action Access should take when users select optionSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 5
  • 6. Understanding Switchboards (continued)Typical switchboard buttonsOpen forms reports and other objects Open other switchboards that list additional database objects Close switchboardOpen the Navigation PaneClose AccessMain switchboardLarge number of database objectsLaunches other switchboardsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 6
  • 7. Typical Switchboard DesignSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 7
  • 8. Designing a SwitchboardSwitchboard ManagerTool to design and customize switchboardCreate main switchboardAdd buttonsSpecify button propertiesAccess creates switchboard formOnly one switchboard per databaseCan contain many pagesSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 8
  • 9. Creating a Switchboard Open Switchboard ManagerSwitchboard Manager dialog boxUse five buttons on Switchboard Manager dialog box to perform tasksCreate secondary switchboards firstVerify new form creationSwitchboard item table Keeps track of switchboard items commands and arguments Should be altered only through Switchboard ManagerSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 9
  • 10. Switchboard Manager ButtonsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 10
  • 11. Edit Switchboard Item Dialog BoxSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 11
  • 12. Switchboard CommandsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 12
  • 13. Formatting a SwitchboardBy default Access switchboards share same layout and design Including background colors and placement of titleSwitchboard Manager doesn’t provide options for modifying switchboard designFormat switchboard in form design viewDo not change command buttons or propertiesSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 13
  • 14. Understanding Basic MacrosMacro Action or series of actions Save time and ensure accuracyUsually assigned to key, key combination, or buttonComposed of series of actions organized in sequence in which they should be performedCreate macroUsing Macro windowSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 14
  • 15. Common Macro ActionsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 15
  • 16. Creating a MacroCreate Access macro in Macro windowSelect the Create tab, and then click the Macro button in the Other groupAction column List actions macro performsClick list arrow in action columnAccess provides over 50 different actionsComment columnDocument action by describing what task it performsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 16
  • 17. Creating a Macro (continued)Action arguments paneProvide additional information for performing macro actionArguments needed vary depending on selected action chosenSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 17
  • 18. Running a MacroIn Macro window Click the Run button in the Design tabClick Run Macro on the Database Tools Ribbon, click the list arrow and select the macro, and then click OKIn the Navigation Pane, click Macros, right-click the macro name, and then click RunSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 18
  • 19. Macro Design ToolbarSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 19
  • 20. Editing a MacroUse Macro windowRearrange order of actions Drag action line to new positionInsert new action between two existing actions Right-click row Click insert rowsDelete actionRight-click row Click delete rowsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 20
  • 21. Setting Startup OptionsStartup optionsAccess performs when database opensUse Startup dialog boxBypass Startup OptionsPress and hold down shift key when opening databaseSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 21
  • 22. Specifying Startup Options in the Startup Dialog BoxOptionsDisplay formDisplay navigation paneAllow full menusSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 22
  • 23. Startup Dialog BoxSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 23
  • 24. Creating a Splash ScreenSplash screenDisplays when database opensContainsLogoTextCan only display splash screen or switchboard automaticallySucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 24
  • 25. Creating a Splash Screen (continued)AutoExecSpecial macroRuns when database opensBefore startup dialog box optionsCan use to display splash screenCreate splash screen formSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 25
  • 26. Creating an AutoExec MacroCreate macro that contains actions Access should perform when database openedSave macro using name AutoExecSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 26
  • 27. Level 1 SummarySwitchboard Special kind of form Appears when database openedMacroUse to automate repeated actionsStartup options dialog boxSplash screenSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 27
  • 28. Level 2 Objectives:Creating Advanced MacrosConsolidate automated tasks by creating a macro groupCreate buttons that can perform a series of actionsTroubleshoot macrosSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 28
  • 29. Understanding Macro GroupsMacro group Two or more macros placed within same macro fileConsolidate related macros Manage large numbers of macrosOnly group name displayed as macro object in database windowSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 29
  • 30. Creating a Macro GroupLogical to organize similar macros within groupTo create Click the Create tab and then click the Macro buttonClick the Macro Names button on the Design tab. Access adds the Macro Name column to the left of the Action columnIn the Macro Name column, enter the name of a macroIn the Action column, enter the corresponding actions for the macroEnter comments as needed in the Comment column, and set arguments as needed in the Action Arguments paneSave the macro group, using the “mcr” prefix in the object nameSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 30
  • 31. Running the Macros in a Macro GroupRun particular macro within groupClick the Run Macro button in the Macro group on the Database Tools RibbonSelect the list arrow to choose the macro nameClick the macro nameClick OKSwitchboard Manager and many property sheetsSpecify name of macro to runSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 31
  • 32. Running the Macros in a Macro GroupRun macro objectEnter or select nameRun only one macro in macro groupUse special notation mcrGroupName.mcrMacroNameSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 32
  • 33. Creating an AutoKeys Macro GroupAutoKeys macro group Assign macro action or set of actions to key or key combinationMacro name columnType key or key combination Use special syntaxSendKeys action Sends keystrokes to Access or to another active programSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 33
  • 34. Examples of Key Combinations for the Autokeys Macro GroupSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 34
  • 35. Modifying the Switchboard to Run MacrosModify switchboard to include Macro group listing macros that open queriesSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 35
  • 36. Specifying Conditions and Events for MacrosSpecify conditions for performing macro actions Assign macro to controlEvent-driven programmingRunning macro when user interacts with objectEvent State condition or occurrence that Access recognizesEvent propertySpecifies how object responds when event occursSet to macro name to run macro when even occursSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 36
  • 37. Assigning a Macro to a ControlCreate macro or macro group that performs series of actionsAssign macro to controlAdd command button to form by opening form in Design viewAttach macro with desired actions to command buttonUsing On Click propertySucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 37
  • 38. Specifying Conditions in a MacroWhere condition argumentRefer to controls on form that are not currently activeUse control’s complete nameFormat[Forms]![formName]![controlName]Succeeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 38
  • 39. Troubleshooting MacrosMacros containing argumentsEspecially error proneError typesSyntax errorLogic errorRun-time errorTroubleshooting toolsSingle step through execution of macro, using debug windowPrint macro codeSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 39
  • 40. Printing MacrosOpen Documenter dialog box Select macroClick options button to select details of macro to printSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 40
  • 41. Single Stepping a MacroRuns macro one action at time Pausing between actionsMake sure actions appear in correct order and with correct argumentsUse Single Step buttonMacro Single Step dialog boxButtonsStepHaltContinueSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 41
  • 42. Using Breakpoints and the Debug WindowBreakpointCode inserted in macroSignals where to stop macroExamine values of actions controls, and arguments macro using in debug windowDebug window Shows macro as it appears in VBA codeExamine details of macro code in debug windowSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 42
  • 43. Using Breakpoints and the Debug Window (continued)Immediate paneDisplays current value of controls and argumentsDisplay using ? operatorSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 43
  • 44. Level 2 SummaryMacro groupConditions for macrosAssign macro to controlDebug macrosSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 44
  • 45. Level 3 Objectives:Macro ConditionsDisplay message boxes under specified conditionsRun a macro when a form opens or a report printsUse a macro to validate dataSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 45
  • 46. Exploring Macro ConditionsMacro conditions Logical expressions that result in true or false answerDepending on outcome Macro can perform one set of actions or anotherEnter macro conditions Open condition column in Macro windowBy clicking Conditions buttonIf condition true Access performs corresponding action in action columnSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 46
  • 47. Exploring Macro ConditionsPerform more than one action if condition true Enter conditional statement in condition column Select actions in action column in order Enter ellipsis (…) for each subsequent action associated with condition in condition columnSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 47
  • 48. Exploring Macro Conditions (continued)SetValue actionChange property of object by disabling, updating, hiding, or displaying controlArguments ItemExpressionSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 48
  • 49. Assigning a Macro to an Object EventAssign macro to object By specifying macro name in event property of objectEvent categoriesReportSectionSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 49
  • 50. Report EventsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 50
  • 51. Report Section EventsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 51
  • 52. Using Message Boxes with FormsForm events can also trigger macrosUse to Validate data Set values Navigate between formsFilter, find, and print recordsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 52
  • 53. Form EventsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 53
  • 54. Using Message Boxes with FormsMsgBox commandOpens message box Displays warning or informational messageMsgBox ("message" sum of button and icon values "title")Returns value depending on which button clickedCreate condition that checks to see which button users clickSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 54
  • 55. Using Message Boxes with ReportsWhen conditions in macro references name of control from source Source must be open when condition testedCan hide window while macro tests conditionMsgBox actionOpens message box and displays warning or informational messageSimilar to using MsgBox commandSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 55
  • 56. Using Message Boxes with Reports (continued)MsgBox action arguments Message Beep TypeTitleSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 56
  • 57. Validating Data with MacrosValidation field properties have limitsValidate data using more than one rule and more than one validation messageCreate macroDomain aggregate functionsCalculate statistics for set of records (recordset) or domain, from table or queryDcount functionDcount(expression, table or query, condition)Succeeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 57
  • 58. Common Domain Aggregate FunctionsSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 58
  • 59. Level 3 SummaryConditional expressions in macrosAssign macros to eventsMessage boxesMsgbox commandMsgbox actionValidate data with macrosSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 59
  • 60. Chapter SummarySwitchboardProvides main menu for Access applicationMacro Automates repetitive tasksCan use conditional expressionsAssociate with command buttons or other controlsDebuggerFind errors in macros by stepping though each statementSucceeding in Business with Microsoft Office Access 2007: A Problem-Solving Approach 60