<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content=Word.Document name=ProgId>
<META content="MSHTML 6.00.2722.900" name=GENERATOR>
<META content="Microsoft Word 10" name=Originator><LINK
href="cid:filelist.xml@01C32BD2.498F7210" rel=File-List><!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:EnvelopeVis/>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<STYLE>@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; mso-header-margin: .5in; mso-footer-margin: .5in; mso-paper-source: 0; }
P.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
LI.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
DIV.MsoNormal {
FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"; mso-style-parent: ""; mso-pagination: widow-orphan; mso-fareast-font-family: "Times New Roman"
}
A:link {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlink {
COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
A:visited {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlinkFollowed {
COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.EmailStyle17 {
COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: personal-compose; mso-style-noshow: yes; mso-ansi-font-size: 10.0pt; mso-bidi-font-size: 10.0pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial; mso-bidi-font-family: Arial
}
SPAN.SpellE {
mso-style-name: ""; mso-spl-e: yes
}
SPAN.GramE {
mso-style-name: ""; mso-gram-e: yes
}
DIV.Section1 {
page: Section1
}
</STYLE>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";}
</style>
<![endif]--></HEAD>
<BODY lang=EN-US style="tab-interval: .5in" vLink=purple link=blue
bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Bob,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>You can set your class module's Instancing property
to '2-PublicNotCreatable' then you can continue to use it the way you used it
without library - you will just need to get its instance by your wrapped/helper
function <SPAN class=SpellE><FONT face="Times New Roman"
size=3>GetclsInventory...</FONT></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=SpellE></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=SpellE>HTH,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=SpellE>Shamil</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=SpellE></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=SpellE></SPAN></FONT>----- Original
Message ----- </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=bobbedell15@msn.com href="mailto:bobbedell15@msn.com">Bob Bedell</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> Friday, June 06, 2003 10:21
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [AccessD] Where does WithEvents
go?</DIV>
<DIV><BR></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">I hope I can make this intelligible. Info on this
issue seems a bit sparse. I have a custom class and a form that work fine
together. The class declares a custom event using Public Event syntax in the
general declaration and Raise syntax in a method. The calling class (the form)
declares a private instance of the class using <SPAN
class=SpellE>WithEvents</SPAN> and instantiates it. No
problems.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">Now I’m trying to import the class into a library
(<SPAN class=SpellE>mda</SPAN>.) and set a reference to it in the database
that contains the calling form. It’s my understanding that my calling
application can’t instantiate the class directly, and needs to use a wrapper
function. So I added a standard module to the calling application that calls a
function in the library database which returns a copy of the object. The
calling database then has a public, shared copy of the object to work with.
The standard module in the calling database is:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">Public <SPAN class=SpellE>g_oInventory</SPAN> <SPAN
class=GramE>As</SPAN> <SPAN
class=SpellE>clsInventory</SPAN><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">Public Sub <SPAN
class=GramE>Startup()</SPAN><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">
</SPAN><SPAN class=GramE>' Get</SPAN> handles to shared
objects<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">
</SPAN>Set <SPAN class=SpellE>g_objInventory</SPAN> = <SPAN
class=SpellE>GetclsInventory</SPAN><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">
</SPAN><SPAN class=SpellE>DoCmd.OpenForm</SPAN> "<SPAN
class=SpellE>frmInventory</SPAN>"<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">End Sub<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">The standard module in the library database (where the
class is located) is:<BR style="mso-special-character: line-break"><![if !supportLineBreakNewLine]><BR
style="mso-special-character: line-break"><![endif]><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">Public Function <SPAN class=SpellE><SPAN
class=GramE>GetclsInventory</SPAN></SPAN><SPAN
class=GramE>()</SPAN><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">
</SPAN>Dim <SPAN class=SpellE>objInventory</SPAN> <SPAN class=GramE>As</SPAN>
<SPAN class=SpellE>clsInventory</SPAN><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes">
</SPAN>Set <SPAN class=SpellE>GetclsInventory</SPAN> = New <SPAN
class=SpellE>clsInventory</SPAN><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">End Function<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">Here’s my problem. Using the library scenario, I can’t
find any place to put my <SPAN class=SpellE>WithEvents</SPAN> statement. The
old declaration (before <SPAN class=SpellE>seperating</SPAN> the class and the
form) was in the forms general declaration:<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">Private <SPAN class=SpellE>WithEvents</SPAN> <SPAN
class=SpellE>m_objProduct</SPAN> <SPAN class=GramE>As</SPAN> <SPAN
class=SpellE>clsInventory</SPAN><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><SPAN style="mso-spacerun: yes"> </SPAN>But now
(library scenario) the declaration needs to be global, needs to include <SPAN
class=SpellE>WithEvents</SPAN>, and needs to be in a class or form module
(<SPAN class=SpellE>WithEvents</SPAN> won’t work in a standard
module).<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">Should I do a VB ActiveX component instead? <SPAN
class=GramE>I’m <SPAN class=SpellE>kinda</SPAN>’ at a loss here.</SPAN> <SPAN
class=GramE>Real limited experience with classes/libraries stuff.</SPAN>
Thanks to anyone who can make heads or tails of
that.<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">Bob<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P></DIV>
<P>
<HR>
<P></P>_______________________________________________<BR>AccessD mailing
list<BR>AccessD@databaseadvisors.com<BR>http://databaseadvisors.com/mailman/listinfo/accessd<BR>Website:
http://www.databaseadvisors.com<BR></BLOCKQUOTE></BODY></HTML>