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?
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.
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
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.
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.
In Microsoft Office Access 2007, you can define a macro to execute just about any task you would otherwise initiate with the keyboard or the mouse. This article introduces you to the unique power of macros in Office Access 2007 — their ability to automate responses to many types of events without forcing you to learn a programming language. The event might be a change in the data, the opening or closing of a form or a report, or even a change of focus from one control to another.
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.
I have a slooow Database. Everytime I go from one form to another (through buttons) it takes longer and longer as time goes (still developing database). So I tried converting my macros ( only bout 10 or so) into VBA through the setup they have on the wizard. My question is, now that I converted to VBA, can I delete the macros? If not then what is the point of converting to VBA other than more flexibility of 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.
I would like to find a simple way to help my users enable their macros. I currently have a database that displays a form as soon as the database is opened. The issue is the form will not work unless Macros are enabled.
I would like to have a form with instructions on how to enable macros. Once the user open the database, if macros are enabled, the form with the instructions will be set to hide, and the regular form will be made visible.
In Excel there is a "Workbook" open event, is there such a thing in Access? Also, how can I prevent the user from accessing the Access optoins and changing the "Display Form" field?