Custom Classes

J

JonWayne

I wrote my first set of classes, which, at the top is a Year class, from
which descends: Months (Collection) - Month - Days (Collection) - Day
objects. Well, all that is fine except, whenever I use then, I get the
run-out-of-stack-space error. Is there any master rule that anyone can share
that halps a developer avoid this error?
 
B

Brendan Reynolds

I wouldn't call it a 'master rule', and I'm not at all sure that it is the
cause of your current problem (though I would not completely rule that out)
but I would strongly recommend not naming anything 'Year', 'Month', or
'Day', as these are all names of built-in VBA functions.

If changing the names doesn't eliminate the out-of-stack-space error, you'll
probably need to post the code that raises the error.
 
J

JonWayne

I did not use those names, I used WYear, WMonth, etc.

Its during initialization of each object that I get the error. During
initialization, I set the year to this year, month to current month ASO.
 
B

Brendan Reynolds

Like I said, you'll probably need to post the code before anyone can help
you. It's pretty hard to debug code that you can't see, you know?
 
G

Graham R Seach

Jon,

As Brendan suggests, you should post your code. But you should be aware that
it may not be the class that's causing the problem; it may just be the thing
that highlights it. I say that because you normally don't get that error
while instantiating an object.

When does the error occur? If you close Access and reboot, does the error
occur the first time the object is instantiated, or some time later after
you've instantiated a dozen objects? If the latter, then you may not be
destroying object references properly.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 

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