<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1126" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=232545618-04022003><FONT face=Arial color=#0000ff size=2>No,
absolutely not. I do recommend having classes to group code for
functionality that you would load multiple instances of.</FONT></SPAN></DIV>
<DIV><SPAN class=232545618-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=232545618-04022003><FONT face=Arial color=#0000ff size=2>Take
an example. I have code to parse a string to get rid of some
character. That is just a function. It is called from queries
(mostly), but may also be called from other functions as well. That
belongs in a library, in a simple module. It is just
code.</FONT></SPAN></DIV>
<DIV><SPAN class=232545618-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=232545618-04022003><FONT face=Arial color=#0000ff size=2>My
class to handle combos on the other hand is loaded into memory, once for each
combo on any form loaded. That class knows how to implement behaviors for
various events. It knows how to load a form for NotInList events in
certain situations. It knows how to load a form for dbl-click events in
other situations. this is code that every combo in my application
uses. DblClick on ANY combo anywhere in my application and something will
happen. A message may pop up informing you that you are not allowed to
edit this list, or a form may open allowing you to edit the data behind the
combo. But that code is generic. EVERY combo can access that code if
I decide to do so. It belongs in the combo class since it is specific to
the combo. Queries are never going to call it. text boxes are never
going to call it.</FONT></SPAN></DIV>
<DIV><SPAN class=232545618-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=232545618-04022003><FONT face=Arial color=#0000ff size=2>You
get the picture? By putting that code in the combo class, when I need to
maintain combo code I can simply say "oh, that is in the combo class". I
no longer have to go hunting through forms to see what function is hooked to the
dbl-click event and go open that function to see how it
works.</FONT></SPAN></DIV>
<DIV><SPAN class=232545618-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><FONT size=2><SPAN class=232545618-04022003>J</SPAN>ohn W. Colby<BR>Colby
Consulting<BR>www.ColbyConsulting.com</FONT> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
accessd-admin@databaseadvisors.com
[mailto:accessd-admin@databaseadvisors.com]<B>On Behalf Of </B>Myke
Myers<BR><B>Sent:</B> Tuesday, February 04, 2003 1:54 PM<BR><B>To:</B>
accessd@databaseadvisors.com<BR><B>Subject:</B> RE: [AccessD] Standard vs.
Class Module<BR><BR></FONT></DIV>
<DIV><SPAN class=035114718-04022003><FONT face=Arial color=#0000ff
size=2>Thanks for an explanation of how you use class module. I had never
considered having a class for each control.</FONT></SPAN></DIV>
<DIV><SPAN class=035114718-04022003><FONT face=Arial color=#0000ff
size=2>Do you recommend using class modules for all
code?</FONT></SPAN></DIV>
<DIV><SPAN class=035114718-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=035114718-04022003><FONT face=Arial color=#0000ff
size=2>Thanks,</FONT></SPAN></DIV>
<DIV><SPAN class=035114718-04022003><FONT face=Arial color=#0000ff
size=2>Myke</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
accessd-admin@databaseadvisors.com
[mailto:accessd-admin@databaseadvisors.com] <B>On Behalf Of </B>John W.
Colby<BR><B>Sent:</B> Monday, February 03, 2003 7:05 PM<BR><B>To:</B>
accessd@databaseadvisors.com<BR><B>Subject:</B> RE: [AccessD] Standard vs.
Class Module<BR><BR></FONT></DIV>
<DIV><SPAN class=025175323-03022003><FONT face=Arial color=#0000ff size=2>A
module is simply a container for code, nothing more. A module can
contain global variables, local variables, functions, subs etc. In the
end however, it is just a container full of code.</FONT></SPAN></DIV>
<DIV><SPAN class=025175323-03022003></SPAN><SPAN
class=025175323-03022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=025175323-03022003><FONT face=Arial color=#0000ff size=2>A
class module defines a class, and holds code and variables that implement
the methods and properties of that class. A class is a template for an
object and an instance of that object (class) will be loaded when you set a
variable = to that class. in other words.</FONT></SPAN></DIV>
<DIV><SPAN class=025175323-03022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=025175323-03022003><FONT face=Arial color=#0000ff
size=2>dim lMyClass as MyClass</FONT></SPAN></DIV>
<DIV><SPAN class=025175323-03022003><FONT face=Arial color=#0000ff
size=2> set lMyClass = new MyClass</FONT></SPAN></DIV>
<DIV><SPAN class=025175323-03022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=025175323-03022003><FONT face=Arial color=#0000ff
size=2>You use classes to create an object which will load into memory and
do something. </FONT></SPAN></DIV>
<DIV><SPAN class=025175323-03022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=025175323-03022003><FONT face=Arial color=#0000ff size=2>In
my framework I have classes for each type of control that Access
provides. One of my classes is for text boxes. Whenever a text
box is opened on my forms, I load a class and pass a pointer to the text box
that just opened. The text box class can now implement behaviors for
that specific text box that "belongs to it" (or v.v.). For example
whenever the text box gets the focus, I can cause the background to change
colors. Or I could compute a value based on the value it already
contains * the value of some other control. </FONT></SPAN></DIV>
<DIV><SPAN class=025175323-03022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=025175323-03022003><FONT face=Arial color=#0000ff size=2>So
a class contains the code for an object. When you dimension a variable
of type (whatever your class name is) and then set the variable, you load an
instance of the class. You can have just one, or a hundred instances
of your class. When my forms load, I have an instance of my text box
class for every text box on my forms. </FONT></SPAN></DIV>
<P><FONT size=2>John W. Colby<BR>Colby
Consulting<BR>www.ColbyConsulting.com</FONT> </P>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B>
accessd-admin@databaseadvisors.com
[mailto:accessd-admin@databaseadvisors.com]<B>On Behalf Of </B>Myke
Myers<BR><B>Sent:</B> Monday, February 03, 2003 6:44 PM<BR><B>To:</B>
accessd@databaseadvisors.com<BR><B>Subject:</B> [AccessD] Standard vs.
Class Module<BR><BR></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=859564123-03022003>Can anyone
describe how to determine when to use a standard module and when to use a
class module in Access?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=859564123-03022003></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=859564123-03022003>TIA Myke</SPAN></FONT></DIV>
<DIV><FONT face=Arial
size=2></FONT> </DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>