By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,812 Members | 863 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,812 IT Pros & Developers. It's quick & easy.

Seeking site describing "Class Modules" in Access 97

P: n/a
MLH
I need a fundamental explanation of Class Modules - something suitable
for newbies. Access 2.0 didn't seem to focus on them very much. Now
that I'm using Access 97, it seems they're everywhere. thx N advance.
Nov 13 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Access97 Developer's Handbook, Getz et al, Sybex

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"MLH" <CR**@NorthState.net> wrote in message
news:0i********************************@4ax.com...
I need a fundamental explanation of Class Modules - something suitable
for newbies. Access 2.0 didn't seem to focus on them very much. Now
that I'm using Access 97, it seems they're everywhere. thx N advance.

Nov 13 '05 #2

P: n/a
MLH
Thx, PC Datasheet. I should have specified an
online source. I'm sure the book is good. I was
hoping to browse something quick & free to
start with.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

On Wed, 26 Jan 2005 01:17:31 GMT, "PC Datasheet" <no****@nospam.spam>
wrote:
Access97 Developer's Handbook, Getz et al, Sybex


Nov 13 '05 #3

P: n/a
My bit:

Classes and objects are a powerful way to think about and organize your
code. A class is the definition of an object. An object is an instance
of its class. I know, it sounds circular.

You define an class by its interface, the properties and methods you
choose to expose to the outside world. Properties are bi-directional
functions that allow you to set and retrieve values from the object.
Methods are simply public Subs or Functions.

The details of how the object does what it does are hidden to the user
of the object. This is called encapsulation. This means you can
completely rewrite a method of an object, and, as long as the new code
is functionally equivalent to the old, the user of the object will
never know the difference.

Unlike modules, classes are never directly used in VBA. What is used
are objects, which are instances of a class. You can have many
instances of the same class open at once. Each instance has its own
unique set of property values. This gives you great power in managing
groups of like things.

You create an object by assigning an object reference variable to a new
instance of the class. You can have multiple references to the same
object. You manage the lifetime of the object by its references. The
object is active as long as you have at least one reference to it. Once
all references to an object are destroyed, the object itself is
destroyed.

Classes can give you more flexibility than modules in solving certain
types of problems. Objects are suited for more dynamic problems, where
you don't know exactly when or what or how many until you happen upon
it. For more static problems, where you know all the variables in
advance, modules may be a better choice.

I don't have any sites handy, but I do have some books I can recommend:

Concepts of Object-Oriented Programming With Visual Basic
Author: Steven Roman
Publisher: Springer-Verlag

This is a short and to-the-point book on objects. Beginner to
intermediate topics are covered. You can find it used on Amazon.com

More advanced:

Effective Visual Basic
Authors: Joe Hummel, et al
Publisher: Addison Wesley

This is an excellent introduction to more advanced object topics. It
also touches on COM, Web services, and Data Access in VB. A little out
of date (doesn't cover .NET), but hey, that suits Access just fine.
-Ken

Nov 13 '05 #4

P: n/a
MLH wrote:
I need a fundamental explanation of Class Modules - something suitable
for newbies. Access 2.0 didn't seem to focus on them very much. Now
that I'm using Access 97, it seems they're everywhere. thx N advance.


Think of a Class Module as a VBA module that comprises one general thing.

In a normal VBA module you have a bunch of constants and variables and
subroutines and functions that do stuff you need. But they are for the
most part standalone items. They can and often do interact (a subroutine
can use a module-level variable, or it can call a function that's also
in the module) but they aren't really part of one cohesive structure.
They're more like people riding the same bus rather than a family in a SUV.

Classes are very similar to regular modules, but they *do* belong to the
same structure. Mom and dad in the front seat, kids in back. All headed
to the mall or whatever. That structure they are all a part of is simply
the class itself.

The class has properties (sort of like module-level variables) and
methods (like module-level subroutines or functions). Generally the
methods of a class are used to set the value of the class's properties,
or to do stuff that pertains strictly to those properties.

If you've ever used a Type in VBA, you'll have a head start on Classes.
In a Type you can have a bunch of related variables, some String, some
Boolean, some Integer, etc. etc.

Same thing for a Class, it can have Strings and Booleans and Integers
and whatnot as its variables (properties). But it can *also* have
subroutines (methods) that touch those properties in various ways as you
need them.

HTH,

--
Terrell Miller
mi******@bellsouth.net

"Every gardener knows nature's random cruelty"
-Paul Simon RE: George Harrison
Nov 13 '05 #5

P: n/a
"MLH" <CR**@NorthState.net> wrote in message
news:0i********************************@4ax.com...
I need a fundamental explanation of Class Modules - something suitable
for newbies. Access 2.0 didn't seem to focus on them very much. Now
that I'm using Access 97, it seems they're everywhere. thx N advance.


Access 2.0 did not have class modules. In fact, office 95 and access 95 also
did not let you create class objects.

This feature become available in office 97.

It is a great step in learning how to create and use objects. In fact, doing
so will make the transition to .net stuff a LOT easier if you learn this
concept (even in ms-access).

Here is an article of mine outlining why and how you can use class objects.

http://www.members.shaw.ca/AlbertKal.../WhyClass.html

The above is a general read, but will at least get your mind thinking.

The following are also some good articles with actual examples:

http://www.microsoft.com/OfficeDev/A...s/classmod.htm

http://www.microsoft.com/AccessDev/Articles/GetzCh3.HTM
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.members.shaw.ca/AlbertKallal
Nov 13 '05 #6

P: n/a
rkc
MLH wrote:
Thx, PC Datasheet. I should have specified an
online source. I'm sure the book is good. I was
hoping to browse something quick & free to
start with.


http://www.microsoft.com/accessdev/articles/getzch3.htm
Nov 13 '05 #7

P: n/a
rkc
MLH wrote:
Thx, PC Datasheet. I should have specified an
online source. I'm sure the book is good. I was
hoping to browse something quick & free to
start with.


http://www.fmsinc.com/tpapers/97classes/
Nov 13 '05 #8

P: n/a
rkc
MLH wrote:
Thx, PC Datasheet. I should have specified an
online source. I'm sure the book is good. I was
hoping to browse something quick & free to
start with.


http://www.devx.com/vb/Article/22610
Nov 13 '05 #9

P: n/a
rkc
MLH wrote:
Thx, PC Datasheet. I should have specified an
online source. I'm sure the book is good. I was
hoping to browse something quick & free to
start with.


http://www.devx.com/vb/Article/22082
Nov 13 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.