Download presentation
Presentation is loading. Please wait.
Published byGilbert Pope Modified over 8 years ago
1
Microsoft Access 2013 ®® Tutorial 10 Automating Tasks with Macros
2
XP Objectives Session 10.1 – Run and add actions to macros – Single step a macro – Create a submacro – Add a command button to a form – Attach a macro to a command Button New Perspectives on Microsoft Access 20132
3
XP Objectives Session 10.2 – Create an unbound form – Add a list box to a form – Use a SQL statement to fill a list box with object names – Create multiple macros for a form – Create a navigation form New Perspectives on Microsoft Access 20133
4
XP Creating a User Interface Case - Chatham Community Health Services Creating a User Interface for the Health Database User would like to implement a user interface for the Health database. For less experienced users, he would like the interface will display specific forms and reports, and all the queries in the database, so that users can select objects they want to work with from the interface For more advanced users, a form that has some buttons that users can click to perform common tasks will be created New Perspectives on Microsoft Access 20134
5
XP Creating a User Interface (Cont.) New Perspectives on Microsoft Access 20135
6
XP New Perspectives on Microsoft Access 20136 Creating a User Interface (Cont.)
7
XP New Perspectives on Microsoft Access 20137 Introduction to Macros
8
XP New Perspectives on Microsoft Access 20138 Running a Macro
9
XP Running a Macro (Cont.) New Perspectives on Microsoft Access 20139
10
XP Adding Actions to a Macro New Perspectives on Microsoft Access 201310 Arguments – A piece of data that is required by an action – MessageBox Four arguments: The Message argument contains text that appears in the message box when it is displayed The Beep argument (Yes or No), specifies whether a beep will sound when the message box opens The Type argument determines which icon, if any, appears Choices are None, Critical Warning? Warning! and Information The Title argument contains the word(s) that will appear in the message box title
11
XP Adding Actions to a Macro (Cont.) New Perspectives on Microsoft Access 201311
12
XP Adding Actions to a Macro (Cont.) New Perspectives on Microsoft Access 201312
13
XP Adding Actions to a Macro (Cont.) New Perspectives on Microsoft Access 201313
14
XP Single Stepping a Macro New Perspectives on Microsoft Access 201314 Single Step Mode – Executes a macro one action at a time, pausing between actions – called single stepping – Allows you to make sure you have placed actions in the right order and with the correct arguments – You can use single step mode to find the causes of problems and to determine corrections – The Single Step button on the DESIGN tab is a toggle you use to turn single step mode on and off Once you turn on single step mode, it stays on for all macros until you turn it off
15
XP Single Stepping a Macro (Cont.) New Perspectives on Microsoft Access 201315
16
XP Using a Command Button with an Attached Macro New Perspectives on Microsoft Access 201316
17
XP Using a Command Button with an Attached Macro (Cont.) New Perspectives on Microsoft Access 201317 Event – A state, condition, or occurrence detectable by Access Event Property – Specifies how an object responds when an event occurs Event Procedure – A group of statements using VBA code that Access executes together
18
XP Using a Command Button with an Attached Macro (Cont.) New Perspectives on Microsoft Access 201318
19
XP Submacros New Perspectives on Microsoft Access 201319 A submacro is a complete macro with a Submacro header within a macro – Allows you to consolidate related macros and to manage large numbers of macros
20
XP Submacros (Cont.) New Perspectives on Microsoft Access 201320
21
XP Submacros (Cont.) New Perspectives on Microsoft Access 201321 The Table Name argument specifies the name of a table that will be opened when the macro is run The View argument specifies the view in which the object opens. The Data Mode argument specifies the table’s data- entry options – Allowable settings for this argument are Add (users can add new records but can’t change or delete existing records), Edit (change and delete existing records and can add new records), and Read Only (only view records) – If you don’t select an argument value, Edit is the default setting
22
XP Adding a Submacro New Perspectives on Microsoft Access 201322 The SelectObject action selects a specified object so that you can run an action that applies to the Object The RunMenuCommand action selects and runs a command on the ribbon The PrintSelection argument, which prints the selected form record
23
XP Adding a Submacro (Cont.) New Perspectives on Microsoft Access 201323
24
XP Adding a Command Button to a Form New Perspectives on Microsoft Access 201324
25
XP Attaching a Submacro New Perspectives on Microsoft Access 201325
26
XP Attaching a Submacro (Cont.) New Perspectives on Microsoft Access 201326
27
XP Designing a User Interface New Perspectives on Microsoft Access 201327
28
XP Creating the frmQueries Form New Perspectives on Microsoft Access 201328
29
XP Adding a List Box to a Form New Perspectives on Microsoft Access 201329
30
XP Adding a List Box to a Form (Cont.) New Perspectives on Microsoft Access 201330
31
XP SQL (Structured Query Language) – A standard language used in querying, updating, and managing relational databases – Used mostly in a relational DBMS such as mySQL or Oracle Using SQL New Perspectives on Microsoft Access 201331
32
XP Viewing a SQL Statement for a Query Using SQL (Cont.) New Perspectives on Microsoft Access 201332
33
XP SELECT Statement – The basic form of a SQL SELECT statement includes four sections, known as clauses – Each clause starts with a different keyword: SELECT, FROM, WHERE, and ORDER BY – After the SELECT keyword, you list the fields you want to display – After FROM, you list the tables used in the query – After WHERE, you list the selection criteria – After ORDER BY, you list the sort fields Using SQL (Cont.) New Perspectives on Microsoft Access 201333
34
XP Using SQL (Cont.) New Perspectives on Microsoft Access 201334
35
XP Using a SQL Statement for a List Box – System tables are special tables maintained by Access that store information about the characteristics of a database and about the structure of the objects in the database – Although system tables do not appear in the Navigation Pane, you can retrieve information from system tables using SELECT statements – One of the system tables, the MSysObjects table, keeps track of the names, types, and other characteristics of every object in a database Using SQL (Cont.) New Perspectives on Microsoft Access 201335
36
XP Using SQL (Cont.) New Perspectives on Microsoft Access 201336
37
XP Using SQL (Cont.) New Perspectives on Microsoft Access 201337
38
XP Adding a Command Button to a Form New Perspectives on Microsoft Access 201338
39
XP Adding a Command Button to a Form (Cont.) New Perspectives on Microsoft Access 201339
40
XP Adding a Command Button to a Form (Cont.) New Perspectives on Microsoft Access 201340
41
XP Creating the Macros for the frmQueries Form New Perspectives on Microsoft Access 201341 – Load Event Occurs when Access opens a form or report
42
XP Creating the Macros for the frmQueries Form (Cont.) New Perspectives on Microsoft Access 201342
43
XP Creating the Macros for the frmQueries Form (Cont.) New Perspectives on Microsoft Access 201343
44
XP Testing the frmQueries Form New Perspectives on Microsoft Access 201344 After creating a custom form, you should test the form in Form view – For the frmQueries form, you need to double-click a query name in the list box to make sure the query datasheet opens – Also, you must scroll the list box, click a query name, and then click the Display command button to make sure the query datasheet opens, and also click the Preview command button to make sure the query opens in Print Preview
45
XP Creating a Navigation Form New Perspectives on Microsoft Access 201345
46
XP Creating a Navigation Form (Cont.) New Perspectives on Microsoft Access 201346
47
XP Creating a Navigation Form (Cont.) New Perspectives on Microsoft Access 201347
48
XP Creating a Navigation Form (Cont.) New Perspectives on Microsoft Access 201348
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.