Methods

A method is an action that can be performed by, or on, an object. When you're in your car, you can invoke the start method of the engine, invoke the release method of the parking break, invoke the shift method of the transmission, and invoke the press method of the gas pedal. Each of these methods causes something to happen. If things work according to your programming, the car goes forward (which can be described as causing the drive method to be executed on the car itself). Generally, an action or event that happens (such as driving) is made up of many other methods performed on multiple objects.

Objects in VBA have methods, as well. For example, you can invoke the LoadPicture method on an ActiveX control within an Access form; this causes a picture to be displayed within the control. One of the frequently used methods moves the cursor to the next record in a DAO recordset:

rst.MoveNext

Was this article helpful?

0 0

Post a comment