Class Module vs. Module - Philosophical Differences

G

Guest

Just out of curiosity, is there an advantage of class module over a regular
module? Is there an additional flexibility/speed of one over the other?
Just what does a Class Module really offer me over a regular Module? Thanks.
 
M

Marshall Barton

vseale said:
Just out of curiosity, is there an advantage of class module over a regular
module? Is there an additional flexibility/speed of one over the other?
Just what does a Class Module really offer me over a regular Module? Thanks.


A class module is a wholly different critter from a standard
module. The whole concept of a class is a rather deep
subject that really requires a text book to cover it
adequately. Access does not provide all the capabilities of
the classic definition of a class, but it does provide an
lot of nice features.

You can have multiple instances of a class. I.e. In a
class, module level variables are tied to its instance so
they are independent of other instances. In a standard
module, a module level variable exists once for your entire
application.

Class modules can also have properties (a Public variable),
methods (a Public Function or Sub) and events. While it is
possible to code a standard module to simulate properties
and methods, it is tedious and standard modules can not trap
events.

Don't forget that all form and report modules are class
modules.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top