Dim off

Sub emptyAD()
Set off = GetObject("", "FlowFact.applicatioN")
'Leere Adressen anzeigen

Pane = "AD"

F_PANE = "F_" & Pane
F_PaneStr = Pane & ".DSN in ("

Set rsTMP = off.getrecordset("Select DSN from AD Where Firma is Null and Name is Null and Straße is NULL and Land_PLZ is NUll and Ort is Null and Telefon Is Null and Fax is Null and EMAIL is Null")

    If rsTMP.RecordCount > 0 Then
        strdsn = ""
        Do While Not rsTMP.EOF
            strdsn = strdsn & "'" & rsTMP("DSN") & "',"
            rsTMP.movenext
        Loop
        strdsn = F_PaneStr & Left(strdsn, Len(strdsn) - 1) & ")"
        
        off.Panes(F_PANE).Find strdsn
        off.Panes(F_PANE).Show
    
    Else
        MsgBox "Keine Datensätze gefunden!"
    End If
    
End Sub

Sub emptyAKT()
Set off = GetObject("", "FlowFact.applicatioN")
Pane = "AKT"
'Leere Aktivitäten anzeigen

F_PANE = "F_" & Pane
F_PaneStr = Pane & ".DSN in ("

Set rsTMP = off.getrecordset("select DSN from AKT Where Subject is Null and Notiz is Null and AD_DSN is null and AD_B_DSN is Null and OBJ_DSN is Null")

If rsTMP.RecordCount > 0 Then
    strdsn = ""
    Do While Not rsTMP.EOF
        strdsn = strdsn & "'" & rsTMP("DSN") & "',"
        rsTMP.movenext
    Loop
    strdsn = F_PaneStr & Left(strdsn, Len(strdsn) - 1) & ")"
    
    off.Panes(F_PANE).Find strdsn
    off.Panes(F_PANE).Show

Else
    MsgBox "Keine Datensätze gefunden!"
End If
End Sub


Sub emptyOBJ()
Set off = GetObject("", "FlowFact.applicatioN")
Pane = "OBJ"
'Leere Objekte anzeigen

F_PANE = "F_" & Pane
F_PaneStr = Pane & ".DSN in ("

Set rsTMP = off.getrecordset("Select DSN from OBJ where INTERN is Null and PROV_INT is Null and Prov_ANB is Null and AKTIV = 1 AND TEXTFREI is Null and TEXTLAGE is Null and TEXTAUSSTATTUNG is Null and TEXTBEBAUBARKEIT is Null and TEXTOBJEKT is Null and AD_ANBIETER_DSN is Null and AD_KOLLEGE_DSN is Null and dsn not in (Select OBJDET.Obj_DSN From OBJ inner join OBJDet on OBJ.dsn = OBJdet.obj_dsn)")

If rsTMP.RecordCount > 0 Then
    strdsn = ""
    Do While Not rsTMP.EOF
        strdsn = strdsn & "'" & rsTMP("DSN") & "',"
        rsTMP.movenext
    Loop
    strdsn = F_PaneStr & Left(strdsn, Len(strdsn) - 1) & ")"
    
    off.Panes(F_PANE).Find strdsn
    off.Panes(F_PANE).Show

Else
    MsgBox "Keine Datensätze gefunden!"
End If
End Sub


Sub ANFnoLink()

' Anfragen ohne Verknüpfung anzeigen

Set off = GetObject("", "FlowFact.applicatioN")
Pane = "ANF"

F_PANE = "F_" & Pane
F_PaneStr = Pane & ".DSN in ("

Set rsTMP = off.getrecordset("select DSN from ANF where AD_DSN is null")

If rsTMP.RecordCount > 0 Then
    strdsn = ""
    Do While Not rsTMP.EOF
        strdsn = strdsn & "'" & rsTMP("DSN") & "',"
        rsTMP.movenext
    Loop
    strdsn = F_PaneStr & Left(strdsn, Len(strdsn) - 1) & ")"
    
    off.Panes(F_PANE).Find strdsn
    off.Panes(F_PANE).Show

Else
    MsgBox "Keine Datensätze gefunden!"
End If
End Sub


Sub DetnoLink()

' Details ohne Verknüpfung anzeigen




Set off = GetObject("", "FlowFact.applicatioN")
Pane = "DETAILS"

F_PANE = "F_" & Pane
F_PaneStr = Pane & ".DSN in ("

Set rsTMP = off.getrecordset("select DSN from Details where AD_DSN is null")

If rsTMP.RecordCount > 0 Then
    strdsn = ""
    Do While Not rsTMP.EOF
        strdsn = strdsn & "'" & rsTMP("DSN") & "',"
        rsTMP.movenext
    Loop
    strdsn = F_PaneStr & Left(strdsn, Len(strdsn) - 1) & ")"
    
    off.Panes(F_PANE).Find strdsn
    off.Panes(F_PANE).Show

Else
    MsgBox "Keine Datensätze gefunden!"
End If
End Sub


Sub AKTnoLink()

' Erledigt Aktivitäten ohne Verknüpfung anzeigen



Set off = GetObject("", "FlowFact.applicatioN")
Pane = "AKT"

F_PANE = "F_" & Pane
F_PaneStr = Pane & ".DSN in ("

Set rsTMP = off.getrecordset("select DSN from AKT where AD_DSN is null and AD_B_DSN is Null and OBJ_DSN is Null and Erledigt = 1")

If rsTMP.RecordCount > 0 Then
    strdsn = ""
    Do While Not rsTMP.EOF
        strdsn = strdsn & "'" & rsTMP("DSN") & "',"
        rsTMP.movenext
    Loop
    strdsn = F_PaneStr & Left(strdsn, Len(strdsn) - 1) & ")"
    
    off.Panes(F_PANE).Find strdsn
    off.Panes(F_PANE).Show

Else
    MsgBox "Keine Datensätze gefunden!"
End If
End Sub



Sub UnfinishedAKTnoLink()

'Unerledigte Aktivitäten ohne Merkmale anzeigen




Set off = GetObject("", "FlowFact.applicatioN")
Pane = "AKT"

F_PANE = "F_" & Pane
F_PaneStr = Pane & ".DSN in ("

Set rsTMP = off.getrecordset("select DSN from Akt where Erledigt = 0 and DSN not in (select Aktmkm.Link_DSN from AKT inner join AKTMKM on AKT.DSN = AKTMKM.Link_DSN)")

If rsTMP.RecordCount > 0 Then
    strdsn = ""
    Do While Not rsTMP.EOF
        strdsn = strdsn & "'" & rsTMP("DSN") & "',"
        rsTMP.movenext
    Loop
    strdsn = F_PaneStr & Left(strdsn, Len(strdsn) - 1) & ")"
    
    off.Panes(F_PANE).Find strdsn
    off.Panes(F_PANE).Show

Else
    MsgBox "Keine Datensätze gefunden!"
End If
End Sub




Sub showBIGAkt()

'Aktivitäten mit großen Anhängen anzeigen

Set off = GetObject("", "FlowFact.applicatioN")
Pane = "AKT"

F_PANE = "F_" & Pane
F_PaneStr = Pane & ".DSN in ("



Do
    intMB = InputBox("Bitte geben Sie die Größe in MegaByte ein ab der die Anhänge angezeigt werden sollen.", "Aktivitäten mit Anhängen größer als ...", 1)
    if intMB = "" then
				exit sub
    end if
Loop Until IsNumeric(intMB) = True 

If InStr(1, intMB, ",") Then
    intMB = Replace(intMB, ",", ".")
End If

Set rsTMP = off.getrecordset("select AKT.DSN from AKT Inner join BLOB on AKT.DSN = BLob.uidLINK_DSN where strLinkTable = 'AKT' and lngTyp <> 30 and lngsize > (1.0 * " & intMB & " * 1024 * 1024) order by lngsize DESC")


If rsTMP.RecordCount > 0 Then
    strdsn = ""
    Do While Not rsTMP.EOF
        strdsn = strdsn & "'" & rsTMP("DSN") & "',"
        rsTMP.movenext
    Loop
    strdsn = F_PaneStr & Left(strdsn, Len(strdsn) - 1) & ")"
    
    off.Panes(F_PANE).Find strdsn
    off.Panes(F_PANE).Show

Else
    MsgBox "Keine Datensätze gefunden!"
End If
End Sub

commands.add "Bau12_0","Datenbank aufräumen","TypeMenu","bmpFolder"
commands.add "Bau12_1","Leere Adressen anzeigen","emptyAD","bmpAD"
commands.add "Bau12_2","Leere Aktivitäten anzeigen","emptyAKT","bmpAKT"
commands.add "Bau12_3","Leere Objekte anzeigen","emptyOBJ","bmpOBJ"
commands.add "Bau12_4","Anfragen ohne Verknüpfung anzeigen","ANFnoLink","bmpANF"
commands.add "Bau12_5","Details ohne Verknüpfung anzeigen","Detnolink","bmpDETAILS"
commands.add "Bau12_6","Aktivitäten ohne Verknüpfungen anzeigen","Aktnolink","bmpAKT"
commands.add "Bau12_7","Unerledigte Aktivitäten ohne Merkmale anzeigen","UnfinishedAKTnoLink","bmpAKT"
commands.add "Bau12_8","Aktivitäten mit großen Anhängen anzeigen","showBIGAkt","bmpAKT"

Set m_cNavBaustein12 = new cNavBaustein12

application.addeventsconsumer m_cNavBaustein12

class cNavBaustein12
Sub ToolbarCustomize
		Commands.NavigatorAdd "","Bau12_0"
		Commands.NavigatorAdd "Bau12_0","Bau12_1"
		Commands.NavigatorAdd "Bau12_0","Bau12_2"
		Commands.NavigatorAdd "Bau12_0","Bau12_3"
		Commands.NavigatorAdd "Bau12_0","Bau12_4"
		Commands.NavigatorAdd "Bau12_0","Bau12_5"
		Commands.NavigatorAdd "Bau12_0","Bau12_6"
		Commands.NavigatorAdd "Bau12_0","Bau12_7"
		Commands.NavigatorAdd "Bau12_0","Bau12_8"
	End Sub
End class