I am currently using VB6 with SP6 and whenever I use the UNLOAD FORMNAME within the module or even use the following code in a function

Code:
Public Function CloseAllForms()
    ' Unload and set each form to Nothing (remove it from memory)
    Dim OpenForm As Form

    For Each OpenForm In Forms
        Unload OpenForm
        Set OpenForm = Nothing
    Next OpenForm

End Function
the IDE crashes. Though when I use this particular function that exists in another program it works ok and I copied the code from my code library in both cases (copy-paste). In one case it accesses access 2000 database and in another it accesses a text file.

I am not sure where to start looking since this code works in some programs but not others and I copied and pasted the code from my code library in ALL cases.

Thanks for any and all help that anyone can offer or suggest.