Access 2000 Class Module Terminates Immediately After Initialization
Any idea why this would be happening? I don't get any error inside th开发者_如何学Goe Class_Initialize
sub, it just jumps straight to the Class_Terminate
sub and the object I assign the class to ends up being Nothing
.
I don't have Access 2000. See whether it has an error trapping option "Break in Class Module". For Access 2003, that option can be found from the VB editor's main menu: choose Tools->Options, then select the "General" tab on the Options dialog. The radio buttons for the Error Trapping choices are located on the middle right of the dialog.
It's not clear to me whether your class module is throwing an error silently. That option should (I hope) help you expose the error ... if there is one.
If that effort is not useful, think I would next set a break point on the first executable line in Class_Initialize, and then step through the code one line at a time with the F8 key. You can see which lines are executed, and at any time while you're in break mode you can inspect the values of variables by printing them to the Immediate Window ... with Debug.Print YourVariable
or the shorter ? YourVariable
A slicker way to monitor your variables is to open the Watches window (from the menu, View->Watch Window), then add variable to it (Debug->Add Watch).
Finally, if those efforts don't lead you to a solution, create a stripped down version of your class module with only the bare minimum code needed to reproduce the problem. Add that code to your question, and also include enough of the calling code to show us how you're attempting to create and use the object instance.
精彩评论