John Colby
jcolby at colbyconsulting.com
Sat Jun 7 09:28:11 CDT 2003
OK, I understand what you are up to. I suppose it is in fact easier to use a class factory than to go through the agony of the export / import, since with the one property exposed inside Access, the process of instantiating the class is all that is left. The exposed property allows the use of the Intellisense functionality. I doubt seriously that I will go to the trouble of re-coding all of my programs, but I may very well use this method in the future. I must say the argument of "breaking fences" and so forth don't mean much to me. This has been possible since A97 and continues through XP so it seems like MS is content to leave things the way they are. John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Shamil Salakhetdinov Sent: Saturday, June 07, 2003 6:06 AM To: AccessD Subject: Re: [AccessD] Where does WithEvents go? <<< > None of the properties that are exposed when > the class is exported to a text > file is visible from within Access. >>> John, Please have a look here/dowload: http://smsconsulting.spb.ru/samples/exposed.jpg (137 244 bytes) I follow the principle that "one good picture is better that thousand words" - and this good IMO picture referenced above shows that VB_Exposed property of MS Access 2000/XP/... VBA modules can be set from within MS Access... > why you wouldn't simply set both of > the properties I discussed to true This is not standard functionality and I can't recommend that because MS can well close this "backdoor" in the future - then all your coding will have to be changed. VB_Exposed is standard for MS Access 2000 and up - so it is safe to use with wrapper class factory functions, subs, custom classes... In general I don't like to use New keyword with custom classes here and there because as I said this makes the coding unorganized - when you've a special class factory code then you can control custom classes' instances creation in the sense that you can concentrate all this code in one-two modules etc. There is also a technical reason of avoiding to use Dim obj as New MyClass This code above AFAIK uses 'just in time custom class instance creation (JITCCIC)' technique - and therefore it may generate a lot of additional support code on compilation... Dim obj as MyClass set obj=new MyClass shouldn't use JITCCIC but to avoid temptation of using shorter code Dim obj as New MyClass I don't use it too :) - speaking seriously: Dim obj as MyClass set obj = MyClassFactoryCreateObject("MyClass") IMO gives a developer much more freedom for future extensions and safety... E.g. using this approach you can well make your class MyClass an Interface Definition Class in the future WITHOUT breaking any of your functionality - etc... Well, all that are my preferences and of course they can be argued... - this message isn't an invitation to such a discussion - I made my choice several years ago :) > What does the wrapper buy you? It seems like extra work, an extra layer > that things have to go through, as well as an extra layer that I have to > write (the helper function). We don't do that with the libs that MS > publishes do we? Yes, some more work but without breaking "MS fences" - they didn't give us an opportunity to set VB_Creatable = True from within VBA editor - in the future they may well introduce this functionality as standard or drop it completely by closing "backdoor" of exporting/manually setting VB_Creatable=True/importing back custom class module. And I don't think they can drop standard (MS Access 2000, 2002,...) functionality of VB_Exposed=true - then they will break versions compatibility... Yes, MS allows to use New with their libraries but they use C++ or VB to write these libraries , where this is a STANDARD (COM-)functionality when these libraries expose their CREATABLE public objects... > > And yes, the ClassExposer add-in would be nice. I will try to make conversion in the near future - it wasn't straightforward "convert to Acc2000" when I tried to make it first time in the past.. And then I also found that MS Acces 2000 has setting VB_Exposed as standard functionality... Shamil ----- Original Message ----- From: "John Colby" <jcolby at colbyconsulting.com> To: <accessd at databaseadvisors.com> Sent: Saturday, June 07, 2003 3:14 AM Subject: RE: [AccessD] Where does WithEvents go? > Shamil, > > None of the properties that are exposed when the class is exported to a text > file is visible from within Access. What I don't quite understand is why > you wouldn't simply set both of the properties I discussed to true and > directly see the classes from any database referencing the library. Doing > this allows seeing all of the class properties, functions etc, as well as > directly dimensioning a class variable. > > What does the wrapper buy you? It seems like extra work, an extra layer > that things have to go through, as well as an extra layer that I have to > write (the helper function). We don't do that with the libs that MS > publishes do we? > > And yes, the ClassExposer add-in would be nice. It appears that the object > on your site is compiled - I can't open or convert it in A2K. I could > certainly write my own if I need to. > > John W. Colby > www.colbyconsulting.com > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Shamil > Salakhetdinov > Sent: Friday, June 06, 2003 6:50 PM > To: AccessD > Subject: Re: [AccessD] Where does WithEvents go? > > > <<< > > If MyClass is in a lib, then this dim statement doesn't work since MyClass > > isn't exposed. > >>> > John, > > But you can dimension the class specifically as that class type if this > custom class's Instancing property is set to PublicNotCreatable. Then you > create instance of this class using wrapper/helper function. And you can > sink an event of this class declared as public. > > Instancng is a standard property for custom class modules in MS Access 2000 > and XP. > > Are we talking about different things? > > Shamil > > P.S. Unfortunately I don't see Instancing property for Forms' and Reports' > modules (am I missing it?) - so maybe ClassExposer Add-In for MS > Access2000/XP to expose forms' and reports' modules isn't a totally crazy > idea.... > > ----- Original Message ----- > From: "John Colby" <jcolby at colbyconsulting.com> > To: <accessd at databaseadvisors.com> > Sent: Saturday, June 07, 2003 12:10 AM > Subject: RE: [AccessD] Where does WithEvents go? > > > > Shamil, > > > > I don't understand how to sink an sourced from a class in a library > without > > being able to dimension the class specifically as that class type > > > > dim withevents SomeCls as MyClass > > > > If MyClass is in a lib, then this dim statement doesn't work since MyClass > > isn't exposed. > > > > John W. Colby > > www.colbyconsulting.com > > > _______________________________________________ > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com