Form Class_Initialize

tuna

Registered User.
Local time
Today, 04:27
Joined
Mar 31, 2010
Messages
27
Given that all form modules are class modules, is a Class_Initialize sub valid? Or does the on open event have exactly the same effect? Thanks
 
I believe that initialize and terminate are somehow included behind the scenes.

This is the best info I found via Google
Stand-alone class modules differ from form and report class modules in several ways.

First, stand-alone class modules do not have a built-in user interface, as form and report class modules do. This makes stand-alone class modules more suited to tasks that do not require an interface, such as performing calculations, looking up data, or modifying a database. When form or report modules require computationally intensive tasks, they can call a stand-alone class module.

Second, stand-alone class modules offer Initialize and Terminate events that enable operations that need to take place at the opening and closing of a class instance. Report and form modules do not have these events, but you can perform similar functions with the Load and Close events.

Third, you must use the New keyword to create instances of stand-alone class modules. Report and form class modules also let you create instances with the DoCmd OpenForm and OpenReport methods as well as by referencing the report or form class module's properties or methods. For example, Form_MyForm.SetFocus opens the MyForm form.

You can create a stand-alone class module from the Insert menu in the Visual Basic Editor. (The same menu offers commands for building a standard module or a procedure.) After creating a class module shell, you can populate it with procedures and declarations, which equip it with custom properties and methods.
 

Users who are viewing this thread

Back
Top Bottom