This paragraph code implements other forms outside of the specified form in VB, which is actually used to close all sub-forms:
code show as below:
'To prevent database connections, you can't close, turn off all windows here.
DIM FRM AS FORM
For Each FRM in Forms
IFfrm.name <> "frmmdimain" THEN Unload FRM
NEXT