B
barbun
Hi from italy !
so sorry for my bad english
I hope to be clear :
***This is for a play similar your Lotto or Bingo, where for win you have to
forecast 8 number on 32 ***
I have a table "Pronostico" with only field "NR" where I put some MY numer
from 1 to 32
(sometimes i put in 23 number, sometimes i pun in 20 number ecc ecc
example of number so are :
2
4
5
7
9
10
11
13
14
15
18
ecc ecc
I simply want generate all possible combination for all number i put in
table "Pronostico" TAKES FOR CLASSES 8
so for the number above some, combination generate will be :
2 4 5 7 9 10 11 13
2 4 5 7 9 10 11 14
2 4 5 7 9 10 11 15
2 4 5 7 9 10 11 18
ecc ecc
I have write this code , where is write "Int(vin!Nr) To Int(vin!Nr)" , is my
last stupid tentative to generate my
all combination.....can you help me in my search ???
Public Sub test20()
Dim Num1 As Byte
Dim Num2 As Byte
Dim Num3 As Byte
Dim Num4 As Byte
Dim Num5 As Byte
Dim Num6 As Byte
Dim Num7 As Byte
Dim Num8 As Byte
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM Colonne;"
DoCmd.SetWarnings True
Set rst = CurrentDb.OpenRecordset("Colonne")
Set vin = CurrentDb.OpenRecordset("Pronostico")
For Num1 = Int(vin!Nr) To Int(vin!Nr)
For Num2 = Int(vin!Nr) To Int(vin!Nr)
If Num2 <> Num1 Then
For Num3 = Int(vin!Nr) To Int(vin!Nr)
If Num3 <> Num1 And Num3 <> Num2 Then
For Num4 = Int(vin!Nr) To Int(vin!Nr)
If Num4 <> Num1 And Num4 <> Num2 And _
Num4 <> Num3 Then
For Num5 = Int(vin!Nr) To Int(vin!Nr)
If Num5 <> Num1 And Num5 <> Num2 And _
Num5 <> Num3 And Num5 <> Num4 Then
For Num6 = Int(vin!Nr) To Int(vin!Nr)
If Num6 <> Num1 And Num6 <> Num2 And Num6 <> _
Num3 And Num6 <> Num4 And Num6 <> Num5 Then
For Num7 = Int(vin!Nr) To Int(vin!Nr)
If Num7 <> Num1 And Num7 <> Num2 And Num7 <> _
Num3 And Num7 <> Num4 And Num7 <> Num5 And Num7 <> Num6 Then
For Num8 = Int(vin!Nr) To Int(vin!Nr)
If Num8 <> Num1 And Num8 <> Num2 And Num8 <> _
Num3 And Num8 <> Num4 And Num8 <> Num5 And Num8 <> Num6 And Num8 <> Num7
Then
rst.AddNew
rst!Num1 = Num1
rst!Num2 = Num2
rst!Num3 = Num3
rst!Num4 = Num4
rst!Num5 = Num5
rst!Num6 = Num6
rst!Num6 = Num7
rst!Num6 = Num8
rst.Update
End If
Next Num8
End If
Next Num7
End If
Next Num6
End If
Next Num5
End If
Next Num4
End If
Next Num3
End If
Next Num2
Next Num1
Set rst = Nothing
End Sub
so sorry for my bad english
I hope to be clear :
***This is for a play similar your Lotto or Bingo, where for win you have to
forecast 8 number on 32 ***
I have a table "Pronostico" with only field "NR" where I put some MY numer
from 1 to 32
(sometimes i put in 23 number, sometimes i pun in 20 number ecc ecc
example of number so are :
2
4
5
7
9
10
11
13
14
15
18
ecc ecc
I simply want generate all possible combination for all number i put in
table "Pronostico" TAKES FOR CLASSES 8
so for the number above some, combination generate will be :
2 4 5 7 9 10 11 13
2 4 5 7 9 10 11 14
2 4 5 7 9 10 11 15
2 4 5 7 9 10 11 18
ecc ecc
I have write this code , where is write "Int(vin!Nr) To Int(vin!Nr)" , is my
last stupid tentative to generate my
all combination.....can you help me in my search ???
Public Sub test20()
Dim Num1 As Byte
Dim Num2 As Byte
Dim Num3 As Byte
Dim Num4 As Byte
Dim Num5 As Byte
Dim Num6 As Byte
Dim Num7 As Byte
Dim Num8 As Byte
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM Colonne;"
DoCmd.SetWarnings True
Set rst = CurrentDb.OpenRecordset("Colonne")
Set vin = CurrentDb.OpenRecordset("Pronostico")
For Num1 = Int(vin!Nr) To Int(vin!Nr)
For Num2 = Int(vin!Nr) To Int(vin!Nr)
If Num2 <> Num1 Then
For Num3 = Int(vin!Nr) To Int(vin!Nr)
If Num3 <> Num1 And Num3 <> Num2 Then
For Num4 = Int(vin!Nr) To Int(vin!Nr)
If Num4 <> Num1 And Num4 <> Num2 And _
Num4 <> Num3 Then
For Num5 = Int(vin!Nr) To Int(vin!Nr)
If Num5 <> Num1 And Num5 <> Num2 And _
Num5 <> Num3 And Num5 <> Num4 Then
For Num6 = Int(vin!Nr) To Int(vin!Nr)
If Num6 <> Num1 And Num6 <> Num2 And Num6 <> _
Num3 And Num6 <> Num4 And Num6 <> Num5 Then
For Num7 = Int(vin!Nr) To Int(vin!Nr)
If Num7 <> Num1 And Num7 <> Num2 And Num7 <> _
Num3 And Num7 <> Num4 And Num7 <> Num5 And Num7 <> Num6 Then
For Num8 = Int(vin!Nr) To Int(vin!Nr)
If Num8 <> Num1 And Num8 <> Num2 And Num8 <> _
Num3 And Num8 <> Num4 And Num8 <> Num5 And Num8 <> Num6 And Num8 <> Num7
Then
rst.AddNew
rst!Num1 = Num1
rst!Num2 = Num2
rst!Num3 = Num3
rst!Num4 = Num4
rst!Num5 = Num5
rst!Num6 = Num6
rst!Num6 = Num7
rst!Num6 = Num8
rst.Update
End If
Next Num8
End If
Next Num7
End If
Next Num6
End If
Next Num5
End If
Next Num4
End If
Next Num3
End If
Next Num2
Next Num1
Set rst = Nothing
End Sub