M
Malcolm Cook
Code DataBases and Class Modules was the subject of an old thread on the subject of creating librarys containing classes that are
instanceable using 'new'.
After an education in this topic, I now find that in Access 2003, you can make your classes instanceable by creating a text file
containing these two lines:
Attribute VB_Exposed = True
Attribute VB_Creatable = True
and then simply opening your class module in the VBA editor and choosing to 'Insert > File' this file.
Checking the modules properties you will now see that it displays the Instanceable property as blank (since Access for some reason
is not supposed to allow this combination of settings).
In practice, I am going to keep the text following my signature in a file which I will insert into my library classes. I know, I
know, it is not 'supported' but I know what to do if it stops being supported ever, and until then, it works well.
Some key messages that educated me on this topic are:
http://groups.google.com/group/comp.databases.ms-access/msg/995388e861eb6d00
http://groups.google.com/group/comp.databases.ms-access/msg/77788950ea8be4c6
http://groups.google.com/group/comp.databases.ms-access/msg/82fe6b2ca5d71c77
Thanks Lyle, Terry, Dev, Michka, Steve, Shamil...
Cheers,
Malcolm Cook - (e-mail address removed)
Database Applications Manager - Bioinformatics
Stowers Institute for Medical Research - Kansas City, MO USA
---
Attribute VB_Exposed = True
Attribute VB_Creatable = True
' NOTE: The instancing property of this MS Access class module has been set using "Insert > File" to
' insert a file containing these following (uncommented) statements
'
' Attribute VB_Exposed = True
' Attribute VB_Creatable = True
'
' The file also contains this documentation which, unlike the statements, you can see in the code window.
' Inserting these Attributes allows the project containing this class to be used as a code library, and
' still have the class be instanceable using the VBA 'new' function.
' THIS IS NOT STRICTLY SUPPORTING IN ACCESS. If it stops working, the library will have to be
' rewritten to provide 'factory' functions in regular module which create such new objects (and
' users of the library will have to be rewritten to no longer call 'New' on the class.
' -- Malcolm Cook <[email protected]>
'
instanceable using 'new'.
After an education in this topic, I now find that in Access 2003, you can make your classes instanceable by creating a text file
containing these two lines:
Attribute VB_Exposed = True
Attribute VB_Creatable = True
and then simply opening your class module in the VBA editor and choosing to 'Insert > File' this file.
Checking the modules properties you will now see that it displays the Instanceable property as blank (since Access for some reason
is not supposed to allow this combination of settings).
In practice, I am going to keep the text following my signature in a file which I will insert into my library classes. I know, I
know, it is not 'supported' but I know what to do if it stops being supported ever, and until then, it works well.
Some key messages that educated me on this topic are:
http://groups.google.com/group/comp.databases.ms-access/msg/995388e861eb6d00
http://groups.google.com/group/comp.databases.ms-access/msg/77788950ea8be4c6
http://groups.google.com/group/comp.databases.ms-access/msg/82fe6b2ca5d71c77
Thanks Lyle, Terry, Dev, Michka, Steve, Shamil...
Cheers,
Malcolm Cook - (e-mail address removed)
Database Applications Manager - Bioinformatics
Stowers Institute for Medical Research - Kansas City, MO USA
---
Attribute VB_Exposed = True
Attribute VB_Creatable = True
' NOTE: The instancing property of this MS Access class module has been set using "Insert > File" to
' insert a file containing these following (uncommented) statements
'
' Attribute VB_Exposed = True
' Attribute VB_Creatable = True
'
' The file also contains this documentation which, unlike the statements, you can see in the code window.
' Inserting these Attributes allows the project containing this class to be used as a code library, and
' still have the class be instanceable using the VBA 'new' function.
' THIS IS NOT STRICTLY SUPPORTING IN ACCESS. If it stops working, the library will have to be
' rewritten to provide 'factory' functions in regular module which create such new objects (and
' users of the library will have to be rewritten to no longer call 'New' on the class.
' -- Malcolm Cook <[email protected]>
'