'===================================================================================
' ROUTINE: Sub CloseAllExcept (ParamArray DontClose())
' SCOPO: Chiude tutte le maschere eccetto....
' ARGOMENTI: ParamArray() - Array di nomi di maschere
' RESTITUISCE: Nulla
' RELASE: 30/7/2000
' AUTORE: Ernesto Cerullo
'===================================================================================
Public Sub CloseAllExcept(ParamArray DontClose())
Dim intCount As Integer
Dim intX As Integer
Dim intLBound As Integer
Dim intUBound As Integer
Dim strTest As String
intLBound = LBound(DontClose)
intUBound = UBound(DontClose)
If intUBound >= intLBound Then
strTest = " IN ("
For intX = intLBound To intUBound
strTest = strTest & "'" & DontClose(intX) & "', "
Next
strTest = Left(strTest, Len(strTest) - 2) & ")"
intCount = Forms.Count - 1
For intX = intCount To 0 Step -1
If Eval("'" & Forms(intX).Name & "'" & strTest) <> True Then
DoCmd.Close acForm, Forms(intX).Name
End If
Next
End If
End Sub
Se si vuole chiudere tutte le maschere aperte tranne la maschera frmStart e la maschera frmStayOpen, richiamare la sub di cui sopra nel modo seguente:Call CloseAllExcept("frmStart", "frmStayOpen")
Nel richiamo della sub occorre indicare il nome di almeno una maschera da dover lascuiare aperta; se si vuole lasciare aperta più di una maschera, indicare nel richiamo i nomi delle maschere da non chiudere scanditi da una virgola.
|