473,472 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VBA - Event Driven Programming

MMcCarthy
14,534 Recognized Expert Moderator MVP
VBA is described as an Event driven programming language. What is meant by this?

Access, like most Windows programs, is an event driven application. This means that nothing happens unless it is in response to some event that has been detected by the application.

The steps are fairly straightforward:
  • An event happens
  • The event is detected by the application
  • The application responds to the event
The Windows OS will automatically detect when an event has occured, like a mouse move, mouse click, form load, etc. If the OS doesn't find a VBA procedure relating to that event it will just go with its default behaviour for that event. The programmer does not need to determine when a particular event happens as Windows does that for you. If you program a procedure to respond to that particular event, then it will override the default behaviour for that event. Therefore, the programmer only needs to code those events where something other than the default behavior should occur. For example, the default behaviour if a button is clicked is that the button gains focus. You only need to code any other tasks you wish to be performed when this event occurs.

Although the obvious event for a button is the Click (On Click) event there are actually 12 possible events associated with a button.

To code an event:

Right click on the object or control you wish to program an event for. Go to properties and go to the Event tab. Choose the event you wish to code e.g. On Click for a button control. Click on the builder button (the one with three dots) and select Code Builder from the list. This will open the Visual Basic Editor with the opening and closing lines of the event procedure already coded. Everything you put between these two lines will execute when the button is clicked.

Every form and report object can have events programmed on them, as can all the controls in those same forms and reports.

Below are some of the more common events with details of when they occur:



There are many more events but these should get you started.
Attached Images
File Type: jpg VBA Events.jpg (73.3 KB, 2594 views)
Nov 26 '07 #1
0 11259

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: alanrn | last post by:
For all you seasoned VB programmers this is going to be a no brainer. However, as a C programmer learning VB I'm having trouble getting my arms around the event-driven nature of VB. Suppose I...
4
by: christopher diggins | last post by:
I just wrote an article on using template specializations for event-driven programming ( http://www.artima.com/weblogs/viewpost.jsp?thread=84958 ). Are there any other examples of this kind of...
1
by: Csaba Gabor | last post by:
Maybe someone has an idea about this... I have two PHP scripts and they would like to efficiently communicate (on a a callback or event driven basis) with each other. If these are CLI versions of...
3
by: msch-prv | last post by:
I am fairly new to PHP. I started creating a variety of classes (calendars, input forms, combo boxes, etc. ) but I am running into code overhead when I integrate these objects (testing for POST,...
14
by: Snor | last post by:
I'm attempting to create a lobby & game server for a multiplayer game, and have hit a problem early on with the server design. I am stuck between using a threaded server, and using an event driven...
4
by: AzizMandar | last post by:
C++ Event Coding Questions I have done some simple programs in C++ and read a lot of good C++ books (Including The C++ Programing Language, and C++ Primer) I am trying to understand and...
2
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite...
8
by: Brad Walton | last post by:
Hello. First post, but been doing a bit of reading here. I am working on a project in Java, but decided to switch over to C# after seeing some of the additional features I can get from C#. One of...
15
by: Phillip B Oldham | last post by:
Are there any python event driven frameworks other than twisted?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.