Autor Thema: Triple Loop  (Gelesen 53 mal)

Sam85

  • Jr. Member
  • **
  • Beiträge: 49
Triple Loop
« am: 9. April 2019, 09:23 »
Guten Morgen,

kann mir jemand erklären, warum dieser Loop nicht funktioniert? Die Kriterien werden alle erfüllt. Oder liegt es daran, dass nur ein Element in dem ersten Array steckt?

Freue mich über eine Rückmeldung.

    Dim K1() as Number
    Dim K2() as Number
    Dim K3() as String
    Dim i, j, k as Number       

    K1 = Array(8)
    K2 = Array(3227, 10699)
    K3 = Array("194001", "194003", "504501")   

    For i = 1 To Count(K1)
        For j = 1 To Count(K2)
            For k = 1 To Count(K3)
                If ({AUFDRUK_TXT.LEISTUNGSKENNZEICHEN} = K1(i) And {AUFDRUK_TXT.PAT-KKASSENR} = K2(j) And Left({AUFDRUK_TXT.HMV-NR},6) = K3(k)) Then
                    Formula = False
                    Exit For
                Else
                    Formula = True
                End If
            Next k
        Next j
    Next i

Vorher hatte ich den Loop so:
    Dim K1 as String
    Dim K2() as Number
    Dim K3() as String
    Dim i, j as Number       

    K1 = "Erstpauschale"
    K2 = Array(3227, 10699)
    K3 = Array("194001", "194003", "504501")
   
    For i = 1 To Count(K3)
        For j = 1 To Count(K2)
            If ({?Kategorie} = K1 And {AUFDRUK_TXT.PAT-KKASSENR} = K2(j) And Left({AUFDRUK_TXT.HMV-NR},6) = K3(i)) Then
                Formula = False
                Exit For
            Else
                Formula = True
            End If
        Next j
    Next i