Symptoms
Using Visual Basic, you create one or more ActiveX DLLs and a Standard EXE(client) application to use the DLLs. The client application runs asexpected within the Visual Basic (IDE) environment. However, when youcompile and run the client application as an EXE, the application producesone of the following errors upon closing:

<project name> caused an invalid page fault inmodule MSVBVM50.DLL at 0137:0f059b41.
-or-

Exception: access violation (0xc0000005), Address: 0×0f059b41
Resolution
This problem can occur when the objects you create in the DLL are notclosed properly by the client application due to a circular reference. Acircular reference occurs, for instance, in the following scenario:
A client application instantiates an object in the ActiveX DLL: theParent object. The Parent object creates another object in the DLL: theChild object. The Parent object sets a property in the Child object thatallows the Child object to have a reference to the Parent object.
This creates a circular reference between the Parent and Child objects.When the client application that created the Parent object sets its objectvariable to Nothing, the Parent object does not terminate because the Childobject maintains a reference to the Parent object. The MORE INFORMATIONsection below describes a specific case for this problem and provides asolution, which is to remove the Child’s reference to the Parent objectbefore closing the Parent object.