CreateEventProc Method

CreateEventProc Method

See Also         Example         Applies To

The CreateEventProc method creates an event procedure in a class module. It returns a Long value that indicates the line number of the first line of the event procedure.

Syntax

object.CreateEventProc(eventname, objectname)

The CreateEventProc method has the following arguments.

Argument Description
object A Module object whose Type property returns acClassModule, a constant with a value of 1.
eventname A string expression that evaluates to the name of an event.
objectname An object that has the event specified by the eventname argument. It may be a Form, Report, or Control object, a form or report section, or a class module.

Remarks

The CreateEventProc method creates a code stub for an event procedure for the specified object. For example, you can use this method to create a Click event procedure for a command button on a form. Microsoft Access creates the Click event procedure in the module associated with the form that contains the command button.

Once you've created the event procedure code stub by using the CreateEventProc method, you can add lines of code to the procedure by using other methods of the Module object. For example, you can use the InsertLines method to insert a line of code.