Event-Driven Programming Using Macros
Learn: What is event-driven programming? What is a trigger? How do I design a trigger? How does the macro editor in Access work? How do I attach a macro to an event? What is the SetValue action? How is it used? How do I make the execution of particular macro actions conditional? What is a switchboard and how do I create one for my application? How to I make things happen when the application is opened? What are the advantages and disadvantages of event-driven programming? (pdf file, install Acrobat Reader to read this tutorial.)
Thank you for taking the time to report an issue.
What's wrong... Please write below.
I have a database that is highly driven by macros. I have been working on rewriting the VBA where I know how. I ran the performance analyzer on a few macros and it said to use the convertto VB tool and I did that and it converted it to VB and I am not sure how to use the VB code for example where do I put it now or does it automatically use it?
For example I have a macro that is run as autoexec when the database opens, and others that run after a button on a form is clicked.
Should I just be copying the code into the correct object event like the click event, etc?
Macros in Access can be considered like a simplified programming language that can be used to increase the functionality of the data base. For example, it can enclose a macro to a command button in a form, so the macro is executed when clicking in the button. The macros contain actions that make tasks, like opening a report, executing a query or to close the data base. Almost all the operations of data bases that normally are made manually can automate by means of macros, thus saving time.
These tutorials are in Adobe Acrobat PDF format. You can download them individually or as a set. To view the files, you need the Acrobat Reader, which Adobe provides at no charge. Topics included: Introduction to Microsoft Access, Tables, Relationships, Basic Queries Using QBE, Basic Queries using SQL, Creating Basic Forms, Parameter Queries, Advanced Forms, Action Queries,
An Introduction to Visual Basic, Event-Driven Programming Using Macros,
Subforms, Data Access Objects, Advanced Triggers, Combo Box Controls
In Microsoft Office Access 2007, macros can be contained in macro objects (sometimes called standalone macros), or they can be embedded into the event properties of forms, reports, or controls. Embedded macros become part of the object or control in which they are embedded. Macro objects are visible in the Navigation Pane, under Macros; embedded macros are not.
This week we'll discuss, for those of you unfamiliar with programming, one of the more conceptually complex aspects of Microsoft Access. We'll start with a discussion of events: what they are and how Access uses them. Then, we'll move on to a lengthy discussion of macros, including what they do and how you design and use them. TOC: Macros; Debugging;
Getting Fancy with Macros.
Access 2007 readers knowledgeable in creating applications with wizards and macros can easily learn how to make their applications more professional using the power of VBA programming.
Microsoft Access provides the ability for you to create macros. A macro refers to a set of actions that can be run automatically, and on demand. Macros are usually configured to run whenever a particular event occurs. You specify what that event is when you create the macro. You could make a macro run when a user presses a certain key, or you could make a macro run everytime your database is opened.
The following articles contain useful information about using macros in Microsoft Access 97 and converting macros to Visual Basic for Applications code.
Macros are very useful for automating simple tasks, such as carrying out an action when the user clicks a command button. You don't need to know how to program to use macros. Macros can perform a number of the common tasks that you can also use Visual Basic code to perform. However, using Visual Basic code instead of macros gives you much more flexibility and power, and there are many things you can only do in code, such as returning values or iterating through recordsets.
I have created a database that uses macros to send reports out to specific locations. The issues I have is I have the database extension as .accdr with short cut keys disabled to a point it prevents users from tampering with the programming and the data.
What I need to do is create a button on the administrator's page that will take the admin user to the macros section to allow them to update email addresses for reports as people come and go.
As you will have seen in the previous topic, we can use Macros to Require Data Entry and to inform users of any errors made in the data entry routine. We can also use Microsoft Access Macros to speed up the process of data entry. We can use a macro to remove the need for a user to enter the same data over and over for each record, we can use a macro to automate this process.
A Microsoft Access macro is a database object that allows us to automate repetative tasks without having to write complex programming routines. In Access, these tasks that the macro performs are know as macro actions.