<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1126" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><SPAN class=706564713-04022003><FONT face=Arial color=#0000ff
size=2>><FONT face=Arial size=2> ... Access Add Ins - Can't
directly use a class in an Add In module. </FONT></FONT></SPAN></DIV>
<DIV><SPAN class=706564713-04022003></SPAN> </DIV>
<DIV><SPAN class=706564713-04022003></SPAN><SPAN class=706564713-04022003><FONT
face=Arial color=#0000ff size=2>Actually you can directly use a class in an
access module. </FONT></SPAN></DIV>
<DIV><SPAN class=706564713-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=706564713-04022003><FONT face=Arial color=#0000ff
size=2><Blatant plug on></FONT></SPAN></DIV>
<DIV><SPAN class=706564713-04022003><FONT face=Arial color=#0000ff size=2>Go to
your local bookstore and buy (or peruse through) Beginning Access 2002 VBA -
ISBN 1-86100-821-x by (among others) Martin Reid and John Colby
</FONT></SPAN></DIV>
<DIV><SPAN class=706564713-04022003><FONT face=Arial color=#0000ff size=2>Look
in chapter 15, Libraries and Addins, page 620 "an undocumented secret" to
discover how you can do this.</FONT></SPAN></DIV>
<DIV><SPAN class=706564713-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=706564713-04022003><FONT face=Arial color=#0000ff size=2>Also
see chapter 14 - Withevents and Raisevents for a discussion with examples of
using Withevents and Raiseevents.</FONT></SPAN></DIV>
<DIV><SPAN class=706564713-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV>
<DIV><SPAN class=706564713-04022003><FONT face=Arial color=#0000ff
size=2><Blatant plug off></FONT></SPAN></DIV></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>Tom
Adams<BR><B>Sent:</B> Tuesday, February 04, 2003 10:17 AM<BR><B>To:</B>
accessd@databaseadvisors.com<BR><B>Subject:</B> Re: [AccessD] Standard vs.
Class Module<BR><BR></FONT></DIV>
<DIV><FONT face=Arial size=2>As a big believer in classes (but a poor doer)
I've tried to move in that direction for years.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I've recently been working behind a class fiend
in a VB project and have had a chance to</FONT></DIV>
<DIV><FONT face=Arial size=2>do more classes.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Here's a "BIG" reason to use classes for those
who're having Senior moments - lookup. I've</FONT></DIV>
<DIV><FONT face=Arial size=2>accumulated hundreds of functions over the years
and occasionally find myself redoing something</FONT></DIV>
<DIV><FONT face=Arial size=2>I've had for years just because I can't find
it. If you </FONT><FONT face=Arial size=2>can remember the class name,
you can lookup </FONT></DIV>
<DIV><FONT face=Arial size=2>the variable. I intend to head in this
direction </FONT><FONT face=Arial size=2>soon - except for ...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> ... Access Add Ins - Can't directly
use a class in an Add In module. I think you could move </FONT></DIV>
<DIV><FONT face=Arial size=2>your class to a VB project </FONT><FONT
face=Arial size=2>and make a Dll and be able to use it directly that way -
will try someday. </FONT></DIV>
<DIV><FONT face=Arial size=2>If anybody knows let </FONT><FONT face=Arial
size=2>me know.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Tom (uh, uh, uh ... oh yea) Adams</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=DWUTKA@marlow.com href="mailto:DWUTKA@marlow.com">Drew Wutka</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=accessd@databaseadvisors.com
href="mailto:'accessd@databaseadvisors.com'">'accessd@databaseadvisors.com'</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, February 03, 2003 6:55
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [AccessD] Standard vs.
Class Module</DIV>
<DIV><BR></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>Hmmmm.....good question. </FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>Let's start with the basics. A standard module is a flat code
page. It can house code, store global variables, and can house
callback functions. The main portion of that is it can house
code. You can put all of the functions and subs within it that you
would like, however, that is all they are, functions and subs, and thus a
standard module is relatively 'unorganized'.</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff size=2>A
Class module is a code 'object'. Being an object allows the Class
module to have properties and procedures. The code within is the same
(language wise), but now you have an organized set of
code.</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>Examples where a Standard Module is useful.</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>modOSMachineName</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>That's the name of a module I have which gives you the name of the
computer you are on. It's a simple API call.</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>modOSUserName</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>Same as above, but it provides the NT Username of the person logged
onto a computer.</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>Can these be put into a class? Yes they can. However,
they are just as organized in their own modules. Putting them into a
class would be useful as a 'Environment' object:</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>Dim env as Environment</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>set env = New Environment</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>debug.print env.MachineName</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>debug.print env.UserName</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>However, if you just want the computer name, here and there, instead
of creating a class object, just to use one property, then it would be
better as it's own function in a module:</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>debug.print fOSMachineName</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>Examples where a Class Module is better:</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>This list would be huge, because when you really dig into Class
modules, you will find that they are so much nicer to use. However, I
have a specific one that I would have liked to use back when I was doing
heavy Access FE development.</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>Way back when, I liked to control the 'toggle' keys on the
keyboard. (Numlock, CapsLock and ScrollLock). What I used to do,
was have a module that had a function to set a toggle key oneway or the
other, and another function to just 'check' the state. What I should
have done, is create a Keyboard Class, or Toggle class, and have that class
'represent' the toggle keys on the keyboard. That way I would be able
to 'control' the keyboard toggles as an object, instead of using multiple
functions.</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2>Drew</FONT></SPAN></DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=543243702-04022003><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </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> Myke Myers
[mailto:mmmtbig@bellsouth.net]<BR><B>Sent:</B> Monday, February 03, 2003
5: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>