[AccessD] Sharing Class Modules in Acc 97 -More

John Colby jcolby at colbyconsulting.com
Thu Oct 23 19:59:22 CDT 2003


>Note: The method noted above will NOT work in Access 2000. In fact if you
try the method above, when the file is imported, Access 2000 resets the
VB_Exposed property to false.

I work in Access 2k day in and out and it absolutely does work in A2K.  I
just tried it again to make sure.  Exported, changed, deleted the original
class, imported, cleaned up, saved, exported again.  The properties were
still True.

John W. Colby
www.colbyconsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of
ggonzalez at cccis.com
Sent: Thursday, October 23, 2003 5:42 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] Sharing Class Modules in Acc 97 -More







Try the Following:
The following is an undocumented way to expose your Access 97 class to all
your projects natively from your library database:
1.  Select your class in the development db.
2.  From the file menu select "Export", and export the class as a text
file.
(Don't choose the general "Save As".)
3.  Open the class module in a text editor, and you will find four
properties
at the top of the code, one of which is VB_EXPOSED=False. Change this
setting to true.
also change VB_Creatable =  to True
4.  Delete the class from the original db.
5.  Open a new class module (Insert menu.)
6.  Choose import file from the insert menu and then select the text file
for
your class, and save.

Voila! You now have a public class. Place the library db in the same folder
as any database. Add a reference it and then call your class natively as if
it were
included in the current database. Note: The method noted above will NOT
work in Access 2000. In fact if you try the method above, when the file is
imported, Access 2000 resets the VB_Exposed property to false. The quick
work around it to import your class with the VB_Exposed flag set to true in
Access 97, (creating a public class) and then, import that class into
Access 2000. This will preserve the VB_Exposed flag setting. Note: If you
want to start your new class as a public class, then simply use notepad to
create a text file which has VB_Exposed=True as its only line. When you
start your class, then import this file before you add code. if the above
does not work, save the db with the class to be called in the sam directory
as the application calling it.

Below is an example:
**************************************
Attribute VB_Name = CLASS NAME
Attribute VB_Creatable = True  !!!!!!CHANGE THIS TO TRUE!!!!!!!
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True  !!!!!!!!CHANGE THIS TO TRUE!!!!!!!
Attribute VB_Description = "CDO MAILING INFO"
 when ready to reimport the modified text file into the db it needs to
imported into a blank class module

Hope this helps



                      Drawbridge.Jack at ic.gc.ca
                      Sent by:                         To:
accessd at databaseadvisors.com
                      accessd-bounces at databasea        cc:
                      dvisors.com                      Subject:  RE:
[AccessD] Sharing Class Modules in Acc 97 -More


                      10/23/2003 04:15 PM
                      Please respond to Access
                      Developers discussion and
                      problem solving






Further to note below-

I did move 2 class modules to  my library.mda type library.
When using another database, I did reset the references to the library.mda
When I look in the object browser, the class modules aren't there.

Any help /advice would be appreciated.
Thanks
jack

-----Original Message-----
From: Drawbridge, Jack: #CIO - BPI
Sent: Wednesday, October 22, 2003 5:39 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] Sharing Class Modules in Acc 97


Is there a way to store Class Modules in a "Library" database or some
mechanism such that you can see the Class Modules from any database? I'm
using Acc97.

jack

_______________________________________________
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




_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list