Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
bilety_inform_1 (1).doc
Скачиваний:
0
Добавлен:
03.08.2019
Размер:
449.54 Кб
Скачать

41. You can specify customized responses to user actions, such as clicking a button, opening a form, or selecting an option in an option group.

Macros can also respond to system conditions.

Also, frequently performed actions can be automated using macros.

Creating a macro as a response to an event is an alternative to using a control wizard.

Writing event procedures in Visual Basic is another alternative, but it requires some skill in programming with precisely constructed commands written in established syntax. Macros are easier, because you select the actions and their arguments from predefined lists, which helps prevent any errors in construction.

Macros can be either embedded in the form or report or available as separate Access objects in the Navigation pane.

A macro is a list of one or more actions that work together to carry out a particular task in response to an event. An event is something that happens to a certain object, a recognized action that occurs and triggers some type of response.

For example, when you click a command button, the Click event occurs and the command button’s event property specifies a response.

Access is an event-driven program, which means it responds to a variety of events if they occur. In fact, if no event occurs, nothing happens at all.When an event occurs, you can have Access responds with a specific action by running a macro or executing a VBA procedure.

Events are grouped into eight categories, depending on the effects of the event. For example, some events relate to the data, others to filters, and still others to keyboard actions.

Each event corresponds to a property of the object to which it applies.

The property usually has the same name or a name similar to the event. For example, the Change event corresponds to the On Change property of several controls. You can set the property to respond to the event in a specified way.

Data events / Error and Timer events/ Filter events/ Focus Events/ Keyboard events/ Mouse events/ Print Events/ Window Events

42. Creating a Macro.

  • The first step in creating a macro is to design the macro carefully by listing the actions you want performed when the event occurs. Each action might require specific arguments or need to be performed only under certain conditions.

  • Next, verify that you are choosing the correct event to which the macro will respond.

  • When you complete the planning and design of the macro action list, you are ready to open the Macro window. You have two ways to start the Macro Builder.

First, click Create / Macro / Macro

In the Tools group:

The Run command runs the macro.

The Single Step command runs the macro one action at a time and displays intermediate information.

The Builder command starts the Expression Builder for help in creating an expression.

Associating the Macro with a Report Event

Access reports support a number of events, which are signals triggered when certain events occur. For example, the On Open event is triggered when users open the report.

If you associate a macro with an event, Access runs the macro each time the event occurs.

43. PIVOT TABLES

This tool enables you to summarize hundreds of records in a concise tabular format. You can then manipulate the layout of the table to see different views of your data.

The simplest level involves the basic lookup and retrieval of information.

For example, if you have a database that lists the company sales reps and their territory sales, you can use a datasheet or form to search for a specific rep and to look up the sales in that rep’s territory. of complexity involves more sophisticated lookup and techniques based on the querying tools, particularly the use of totals and calculated fields.

For example, if the company in the preceding example has four regions, you might want to see separate totals for each region broken down by quarter. One solution is to set up four different queries that use the Sum function. But what if there were a dozen functions? Or a hundred? Ideally, you need some way of summarizing the database information into a “sales table” that has a row for each region and a column for each quarter.

This is exactly what PivotTables do.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]