I have an application under development structured as follows:

Form1 - Welcome splash
Form 2 - General Description
Form 3 - Detail 1
Form 4 - Detail 1.1
...
Form n - Detail 1.1...n

Users will browse in the following sequence:

Form 1 -> Form2 -> ......-> Form n

Concerned with the number of forms that might be opened at the same time (the application will be a very large product catalog), and also concerned with possible memory limitations at the user's machine, I decided that only two forms should be open at the same time:

Form1 - to which a user can return, via a menu placed in the other form being displayed at a given moment, and

Form n - which is where the user is at that given moment.

All other forms shall be unloaded, thus freeing memory.

I wrote the following code:
___________________________________
Public Sub UnloadNotCurrentForms()
Dim NotCurrentForm As Form
Dim FormName As String
'INITIATE FOR ... NEXT PROCEDURE
For Each NotCurrentForm In Forms
FormName = UCase(NotCurrentForm.Name)
Select Case FormName
'KEEP CURRENTFORM OPEN
Case "FORM1"&".frm", "FORMN"&".frm"
'UNLOAD ALL OTHER FORMS & SET THEM = NOTHING
Case Else
Unload NotCurrentForm
Set NotCurrentForm = Nothing
End Select
Next NotCurrentForm

End Sub
______________________
Please realize that:

1- This code exists in each form
2- "FORM1" & ".frm", "FORMN" & ".frm" are, respectivelly, the Splash form and the form at which the user is when "Formn" is shown.

Although I can run the program while in programmimg mode, as well as after I create the executable, clicking Alt+Tab in W95 let me see that ALL forms previously seen remain open.

In other words, no forms are unloaded or set to Nothing with my code.

I also tried the code:

Case "FORM1", "FORMN"

that is, eliminating the attribute ".frm"

Would anybody tell me what am I doing wrong, please



------------------
Paul Stermann
DSI-Houston