An event is something that happens to an object. The car turns when you turn the steering wheel. The horn blares when you press it. The door closes when you pull it. Turning, blaring, and closing are all events of the car. Events and methods are related in a cause-and-effect way. An event happens when the user does something. The actual doing is the method. So you invoke the move method on the wheel and the car invokes the turn event. It's sometimes difficult to grasp the difference between the two; it'll become clearer as you take a look at the relationship between the methods and events of an Access form.

When you open an Access form, you actually raise (or cause to happen) the OnOpen event. When you close the form, you raise the OnClose event. Within code, however, you can invoke the Open method of the form. Invoking the Open method causes the OnOpen event to fire. So, invoking a method causes an event to happen or fire.

Now that you know a bit more about properties, methods, and events, you're ready for a brief review of the fundamentals of VBA programming.

Was this article helpful?

0 0

Post a comment