Attaching Logic to Data using Data Macro in MS Access 2010


In order to facilitate automation in MS Access Macro are alternative over VBA. This article specificly focus on Table or Data Macro.Table macro works in a similar way as Triggers does in MS SQL Server.This feature could be exploited in numerous ways to do accomplish various task.To implement this concept first of all we need to create a Database containing a table named tblStudent.Table will contain four different fields as shown in figure.

Attaching Logic to Data using Data Macro in MS Access 2010 Fig Fig-1.1

Fig:-1.1

Now if we want to associate a particular Macro with this table depending on requirement we can do so using option Data macro in Design View.For the purpose of example we are considering After Insert event.

Attaching Logic to Data using Data Macro in MS Access 2010 Fig Fig-1.2

Fig:-1.2

As shown in above figure,we have associated a macro named DataMacro1 with After Insert Event of Table named tblStudent. In order to complete above step ,we first need to create a Macro named DataMacro1.This macro have been shown in figure fig 1.3,As shown below Macro contains code for updating fields in another table named tblStudetails.

Attaching Logic to Data using Data Macro in MS Access 2010 Fig Fig-1.3

Fig:-1.3

After inserting records in table tblStudent values would be subsequently updated into another table as well. Similar operation could be performed for other scenerio as well like when some record going to be deleted,updated etc.


DISCLAIMER

It is advised that the information provided in the article should not be used for any kind formal or production programming purposes as content of the article may not be complete or well tested. ERP Makers will not be responsible for any kind of damage (monetary, time, personal or any other type) which may take place because of the usage of the content in the article.


 

BUY SERVICES CONTACT