AccesSoft - Articles - Work with databases in MS Access
Main | Articles | Links | Map
MS Access
Development cycles
Concept of the table
Properties of the table
Creation of the table
Linkage of tables
The scheme of data
Inquiries
Forms
Reports
Macros
Modules
External data
Network work
The client a server
Protection of data

Means of macroprogramming in MS Access

Access, as well as any other developed program system, possesses means of development of the program appendices focused on end users. These means are based on tools of two types: макросах and modules. The concept макроса means presence of a set of some standard commands of system, or macros (it is admissible, such as opening of the form, performance of inquiry, a conclusion of the report) from which it is designed itself macros.

Макрос there can be as actually a macrocatfish, consisting of sequence of macros, and group of macroowls. Group of macroowls name their set kept under the general name. In some cases for the decision, whether the certain macro should in started макросе to be carried out, conditional expression can be applied.
Special interest causes the mechanism of a call of macroowls in Access. For this purpose exists two basic opportunities:

  • Call макроса on a command of the user (or it is direct from section Макросы of the main window of a database, or by means of the menu or the panel of tools with which it also can be ассоциирован)
  • Call макроса on some system event (opening or closing of the form, change of an operating element and т. Item)
  • Rather useful the opportunity to organize automatic performance of some actions is represented at opening a database. For this purpose they should be described in special макросе with name Autoexec

The opportunity of application of macroowls at work in Access environment can show evidently on a following example. We shall assume, that in earlier created form of the Paper we wish to add procedure of the additional control of entered values of dates of issue of securities which should give out warning message if too "early" date is entered. We shall admit(allow), that the dates previous on January, 1st, 1991 concern to those.

Technically the decision is represented convenient to realize in the form of макроса, caused on event " before updating ", ассоциированному with field ДатаЭм in the form of the Paper.
On fig. 7.28 process of development of data макроса (to it(him) it is named КонтрольДатаЭм) is shown. From it(him) it is visible, that макрос contains three macros:

  • The first, ОстановитьМакрос - interrupts work if date later is entered, than on January, 1st, 1991
  • The second, ОстановитьМакрос - is carried out, if the user considers, that despite of the made prevention the entered date is true. For a conclusion of the prevention built in function MsgBox is used
  • The third, cancels event of data input if they after the prevention admit erroneous

Good style of development of macroowls is supply by their comments had in the corresponding column.

On fig. the binding developed макроса to event " before updating " fields ДатаЭм of the form of the Paper is shown.

 

 

 

 

The author: Y.N.Antonov Оптимизация приложений Is added: 21.06.2008

Main | Articles | Links | Map

Copyright 2007 - 2008 AccesSoft. All Rights Reserved