CISA FotoGallery

Statistiche

Tot. visite contenuti : 928190
Home Articoli tecnici Moduli Chiudi tutte le Forms(Avanzato)

Chiudi tutte le Forms(Avanzato)

CODICE

'==========================================================
' 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
'==========================================================

'Esempio di chiamata
' Call CloseAllExcept("frmStart", "frmStayOpen")

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