Parameter for Class_Initialize event

V

Vilem Sova

I'm wondering if it's possible (and if so how because I get errors when I
try) to add an optional parameter to a class module's Class_Initialize
event. This is so I can instantiate a new object and identify which object I
want to instantiate at the same time - something like Set clsMyObject = New
CuteOjbect(lngObjectID). But note that I want the parameter to be optional.

Thanks,
Vilem Sova
Canberra, Australia
 
D

Dan Artuso

Hi,
No can do in VBA. You have to do it in two steps.
Instantaite the object and then set the ID property.

You *can* do this in .Net because even VB has class constructors now.
Of course, that's no help in Access for now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top