Option Compare Database
Option Explicit
Const maxb As Integer = 9                    ' S E N D M O R Y
Dim von As Variant
Dim bis As Variant
Dim used(0 To 9) As Boolean
Dim b(1 To maxb) As Long
Dim i As Byte




Public Sub test(i As Integer)
  Dim j, k As Byte
  For j = von(i) To bis(i)
    If Not used(j) Then
      b(i) = j
      used(j) = True
      If i < maxb Then test (i + 1)
      Else
        'For k = 1 To maxb
        '  Debug.Print (b(k));
        'Next k
        'Debug.Print
        If ((b(1) * 10 + b(2)) * 10 + b(3)) * 10 + b(4) + _
           ((b(5) * 10 + b(6)) * 10 + b(7)) * 10 + b(2) = _
           (((b(5) * 10 + b(6)) * 10 + b(3)) * 10 + b(2)) * 10 + b(8) Then
          For k = 1 To maxb
            Debug.Print (b(k));
          Next k
          Debug.Print "  OK"
        End If
      End If
      used(b(i)) = False
  Next j
End Sub



Public Sub testtest()
  von = Array(0, 1, 0, 0, 0, 1, 0, 0, 0, 0)
  bis = Array(9, 9, 9, 9, 9, 9, 9, 9, 9, 9)
  test (1)
End Sub
