Dovrei permettere la scrematura dei dati tramite multipli di checkbox
Mattina1
Mattina2
Mattina3
Pomeriggio
Sera
Notte
per la turnazione
codice:
iturno = 0
iturno2 = 0
iturno3 = 0
iturno4 = 0
iturno5 = 0
iturno6 = 0
If chk_m1.Value = 1 And chk_m2.Value = 1 Then
iturno = 1
iturno2 = 2
ElseIf chk_m1.Value = 1 And chk_m3.Value = 1 Then
iturno = 1
iturno3 = 3
ElseIf chk_m1.Value = 1 And chk_p.Value = 1 Then
iturno = 1
iturno4 = 4
ElseIf chk_m1.Value = 1 And chk_n1.Value = 1 Then
iturno = 1
iturno5 = 5
ElseIf chk_m1.Value = 1 And chk_n2.Value = 1 Then
iturno = 1
iturno6 = 6
ElseIf chk_m1.Value = 1 And chk_m2.Value = 1 And chk_p.Value = 1 Then
iturno = 1
iturno2 = 2
iturno4 = 4
ElseIf chk_m1.Value = 1 And chk_m2.Value = 1 And chk_m3.Value = 1 Then
iturno = 1
iturno2 = 2
iturno3 = 3
ElseIf chk_m1.Value = 1 And chk_m2.Value = 1 And chk_n1.Value = 1 Then
iturno = 1
iturno2 = 2
iturno5 = 5
ElseIf chk_m1.Value = 1 And chk_m2.Value = 1 And chk_n2.Value = 1 Then
iturno = 1
iturno2 = 2
iturno6 = 6
ElseIf chk_m1.Value = 1 And chk_m3.Value = 1 And chk_p.Value = 1 Then
iturno = 1
iturno3 = 3
iturno4 = 4
ElseIf chk_m1.Value = 1 And chk_p.Value = 1 And chk_n1.Value = 1 Then
iturno = 1
iturno4 = 4
iturno5 = 5
ElseIf chk_m1.Value = 1 And chk_m2.Value = 1 And chk_p.Value = 1 Then
iturno = 1
iturno2 = 2
iturno4 = 4
ElseIf chk_m1.Value = 1 And chk_p.Value = 1 And chk_n2.Value = 1 Then
iturno = 1
iturno4 = 4
iturno6 = 6
ElseIf chk_m1.Value = 1 And chk_n1.Value = 1 And chk_n2.Value = 1 Then
iturno = 1
iturno5 = 5
iturno6 = 6
ElseIf chk_m2.Value = 1 And chk_m3.Value = 1 Then
iturno2 = 2
iturno3 = 3
ElseIf chk_m2.Value = 1 And chk_p.Value = 1 Then
iturno2 = 2
iturno4 = 4
ElseIf chk_m2.Value = 1 And chk_n1.Value = 1 Then
iturno2 = 2
iturno5 = 5
ElseIf chk_m2.Value = 1 And chk_n2.Value = 1 Then
iturno2 = 2
iturno6 = 6
ElseIf chk_p.Value = 1 And chk_n1.Value = 1 Then
iturno = 4
iturno2 = 5
ElseIf chk_p.Value = 1 And chk_n2.Value = 1 Then
iturno4 = 4
iturno6 = 6
ElseIf chk_n2.Value = 1 And chk_n1.Value = 1 Then
iturno5 = 5
iturno6 = 6
End If
Set gRsturni = New ADODB.Recordset
gsSQL = "SELECT * FROM Personaleoperativointurni INNER JOIN Personale ON personaleoperativointurni.RCodPer = Personale.CodPer WHERE data BETWEEN """ & cbb_data.Text & """ AND """ & cbb_dataFINE.Text & """ OR RcodTurno = " & iturno & " or RcodTurno = " & iturno2 & " OR RcodTurno = " & iturno3 & "OR RcodTurno = " & iturno4 & "OR RcodTurno = " & iturno5 & "OR RcodTurno = " & iturno6 & ""
gRsturni.Open gsSQL, gCnGestione
Call Caricagriglialistacompleta
End Sub
Sbaglio e si vede.. io vorrei che se schiaccio mattina1 mattina2 e Pomeriggio o le altre possibili varianti e possibilita mi ricerchi tutti quelli che fanno il turno secondo quello che schiaccio...
Matrice di checkbox ma per l'sql?
Help Please...