1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
| Dim valeur_com As String
Dim opt_1_and As String: Dim opt_1_table As String: Dim opt_1_champ As String: Dim opt_1_signe As String: Dim opt_1_rep As String
Dim opt_2_and As String: Dim opt_2_table As String: Dim opt_2_champ As String: Dim opt_2_signe As String: Dim opt_2_rep As String
Dim opt_3_and As String: Dim opt_3_table As String: Dim opt_3_champ As String: Dim opt_3_signe As String: Dim opt_3_rep As String
Dim opt_4_and As String: Dim opt_4_table As String: Dim opt_4_champ As String: Dim opt_4_signe As String: Dim opt_4_rep As String
Dim opt_5_and As String: Dim opt_5_table As String: Dim opt_5_champ As String: Dim opt_5_signe As String: Dim opt_5_rep As String
Dim opt_6_and As String: Dim opt_6_table As String: Dim opt_6_champ As String: Dim opt_6_signe As String: Dim opt_6_rep As String
Dim SQL_Q1P4 As String
Private Sub Form_Open(Cancel As Integer)
Me.opt_1.Value = 0
Me.opt_2.Value = 0
Me.opt_3.Value = 0
Me.opt_4.Value = 0
Me.opt_5.Value = 0
Me.opt_6.Value = 0
valeur_com = "BIRC18"
End Sub
Private Sub opt_1_Click()
Me.Refresh
If Me.opt_1.Value = True Then
If opt_1_and = " and [" Or opt_2_and = " and [" Or opt_3_and = " and [" Or opt_4_and = " and [" Or opt_5_and = " and [" Or opt_6_and = " and [" Then
opt_1_and = " or ["
opt_1_table = valeur_com
opt_1_champ = "].[Q1T]"
opt_1_signe = "="
opt_1_rep = Chr(34) & 1 & Chr(34)
Else
opt_1_and = " and ["
opt_1_table = valeur_com
opt_1_champ = "].[Q1T]"
opt_1_signe = "="
opt_1_rep = Chr(34) & 1 & Chr(34)
End If
Else
opt_1_and = ""
opt_1_table = ""
opt_1_champ = ""
opt_1_signe = ""
opt_1_rep = ""
End If
If Me.opt_2.Value = True Then
If opt_1_and = " and [" Or opt_2_and = " and [" Or opt_3_and = " and [" Or opt_4_and = " and [" Or opt_5_and = " and [" Or opt_6_and = " and [" Then
opt_2_and = " or ["
opt_2_table = valeur_com
opt_2_champ = "].[Q1T]"
opt_2_signe = "="
opt_2_rep = Chr(34) & 2 & Chr(34)
Else
opt_2_and = " and ["
opt_2_table = valeur_com
opt_2_champ = "].[Q1T]"
opt_2_signe = "="
opt_2_rep = Chr(34) & 2 & Chr(34)
End If
Else
opt_2_and = ""
opt_2_table = ""
opt_2_champ = ""
opt_2_signe = ""
opt_2_rep = ""
End If
If Me.opt_3.Value = True Then
If opt_2_and = " and [" Or opt_1_and = " and [" Or opt_3_and = " and [" Or opt_4_and = " and [" Or opt_5_and = " and [" Or opt_6_and = " and [" Then
opt_3_and = " or ["
opt_3_table = valeur_com
opt_3_champ = "].[Q1T]"
opt_3_signe = "="
opt_3_rep = Chr(34) & 3 & Chr(34)
Else
opt_3_and = " and ["
opt_3_table = valeur_com
opt_3_champ = "].[Q1T]"
opt_3_signe = "="
opt_3_rep = Chr(34) & 3 & Chr(34)
End If
Else
opt_3_and = ""
opt_3_table = ""
opt_3_champ = ""
opt_3_signe = ""
opt_3_rep = ""
End If
If Me.opt_4.Value = True Then
If opt_2_and = " and [" Or opt_3_and = " and [" Or opt_1_and = " and [" Or opt_4_and = " and [" Or opt_5_and = " and [" Or opt_6_and = " and [" Then
opt_4_and = " or ["
opt_4_table = valeur_com
opt_4_champ = "].[Q1T]"
opt_4_signe = "="
opt_4_rep = Chr(34) & 4 & Chr(34)
Else
opt_4_and = " and ["
opt_4_table = valeur_com
opt_4_champ = "].[Q1T]"
opt_4_signe = "="
opt_4_rep = Chr(34) & 4 & Chr(34)
End If
Else
opt_4_and = ""
opt_4_table = ""
opt_4_champ = ""
opt_4_signe = ""
opt_4_rep = ""
End If
If Me.opt_5.Value = True Then
If opt_1_and = " and [" Or opt_2_and = " and [" Or opt_3_and = " and [" Or opt_4_and = " and [" Or opt_5_and = " and [" Or opt_6_and = " and [" Then
opt_5_and = " or ["
opt_5_table = valeur_com
opt_5_champ = "].[Q1T]"
opt_5_signe = "="
opt_5_rep = Chr(34) & 5 & Chr(34)
Else
opt_5_and = " and ["
opt_5_table = valeur_com
opt_5_champ = "].[Q1T]"
opt_5_signe = "="
opt_5_rep = Chr(34) & 5 & Chr(34)
End If
Else
opt_5_and = ""
opt_5_table = ""
opt_5_champ = ""
opt_5_signe = ""
opt_5_rep = ""
End If
If Me.opt_6.Value = True Then
If opt_1_and = " and [" Or opt_2_and = " and [" Or opt_3_and = " and [" Or opt_4_and = " and [" Or opt_5_and = " and [" Or opt_6_and = " and [" Then
opt_6_and = " or ["
opt_6_table = valeur_com
opt_6_champ = "].[Q1T]"
opt_6_signe = "="
opt_6_rep = Chr(34) & 6 & Chr(34)
Else
opt_6_and = " and ["
opt_6_table = valeur_com
opt_6_champ = "].[Q1T]"
opt_6_signe = "="
opt_6_rep = Chr(34) & 6 & Chr(34)
End If
Else
opt_6_and = ""
opt_6_table = ""
opt_6_champ = ""
opt_6_signe = ""
opt_6_rep = ""
End If
Me.Refresh
Call Q1P4_Calcul
End Sub
Private Sub opt_2_Click()
Me.Refresh
Call opt_1_Click
End Sub
Private Sub opt_3_Click()
Me.Refresh
Call opt_1_Click
End Sub
Private Sub opt_4_Click()
Me.Refresh
Call opt_1_Click
End Sub
Private Sub opt_5_Click()
Me.Refresh
Call opt_1_Click
End Sub
Private Sub opt_6_Click()
Me.Refresh
Call opt_1_Click
End Sub
Private Sub Q1P4_Calcul()
If Me.opt_1.Value = 0 And Me.opt_2.Value = 0 And Me.opt_3.Value = 0 And Me.opt_4.Value = 0 And Me.opt_5.Value = 0 And Me.opt_6.Value = 0 Then
opt_1_and = "": opt_1_table = "": opt_1_champ = "": opt_1_signe = "": opt_1_rep = ""
opt_2_and = "": opt_2_table = "": opt_2_champ = "": opt_2_signe = "": opt_2_rep = ""
opt_3_and = "": opt_3_table = "": opt_3_champ = "": opt_3_signe = "": opt_3_rep = ""
opt_4_and = "": opt_4_table = "": opt_4_champ = "": opt_4_signe = "": opt_4_rep = ""
opt_5_and = "": opt_5_table = "": opt_5_champ = "": opt_5_signe = "": opt_5_rep = ""
opt_6_and = "": opt_6_table = "": opt_6_champ = "": opt_6_signe = "": opt_6_rep = ""
SQL_Q1P4 = ""
Else
If opt_1_and = " and [" Then
SQL_Q1P4 = opt_1_and & opt_1_table & opt_1_champ & opt_1_signe & opt_1_rep & opt_2_and & opt_2_table & opt_2_champ & opt_2_signe & opt_2_rep & opt_3_and & opt_3_table & opt_3_champ & opt_3_signe & opt_3_rep & opt_4_and & opt_4_table & opt_4_champ & opt_4_signe & opt_4_rep & opt_5_and & opt_5_table & opt_5_champ & opt_5_signe & opt_5_rep & opt_6_and & opt_6_table & opt_6_champ & opt_6_signe & opt_6_rep
Else
If opt_2_and = " and [" Then
SQL_Q1P4 = opt_2_and & opt_2_table & opt_2_champ & opt_2_signe & opt_2_rep & opt_1_and & opt_1_table & opt_1_champ & opt_1_signe & opt_1_rep & opt_3_and & opt_3_table & opt_3_champ & opt_3_signe & opt_3_rep & opt_4_and & opt_4_table & opt_4_champ & opt_4_signe & opt_4_rep & opt_5_and & opt_5_table & opt_5_champ & opt_5_signe & opt_5_rep & opt_6_and & opt_6_table & opt_6_champ & opt_6_signe & opt_6_rep
Else
If opt_3_and = " and [" Then
SQL_Q1P4 = opt_3_and & opt_3_table & opt_3_champ & opt_3_signe & opt_3_rep & opt_1_and & opt_1_table & opt_1_champ & opt_1_signe & opt_1_rep & opt_2_and & opt_2_table & opt_2_champ & opt_2_signe & opt_2_rep & opt_4_and & opt_4_table & opt_4_champ & opt_4_signe & opt_4_rep & opt_5_and & opt_5_table & opt_5_champ & opt_5_signe & opt_5_rep & opt_6_and & opt_6_table & opt_6_champ & opt_6_signe & opt_6_rep
Else
If opt_4_and = " and [" Then
SQL_Q1P4 = opt_4_and & opt_4_table & opt_4_champ & opt_4_signe & opt_4_rep & opt_5_and & opt_5_table & opt_5_champ & opt_5_signe & opt_5_rep & opt_1_and & opt_1_table & opt_1_champ & opt_1_signe & opt_1_rep & opt_2_and & opt_2_table & opt_2_champ & opt_2_signe & opt_2_rep & opt_3_and & opt_3_table & opt_3_champ & opt_3_signe & opt_3_rep & opt_6_and & opt_6_table & opt_6_champ & opt_6_signe & opt_6_rep
Else
If opt_5_and = " and [" Then
SQL_Q1P4 = opt_5_and & opt_5_table & opt_5_champ & opt_5_signe & opt_5_rep & opt_1_and & opt_1_table & opt_1_champ & opt_1_signe & opt_1_rep & opt_2_and & opt_2_table & opt_2_champ & opt_2_signe & opt_2_rep & opt_3_and & opt_3_table & opt_3_champ & opt_3_signe & opt_3_rep & opt_4_and & opt_4_table & opt_4_champ & opt_4_signe & opt_4_rep & opt_6_and & opt_6_table & opt_6_champ & opt_6_signe & opt_6_rep
Else
If opt_6_and = " and [" Then
SQL_Q1P4 = opt_6_and & opt_6_table & opt_6_champ & opt_6_signe & opt_6_rep & opt_1_and & opt_1_table & opt_1_champ & opt_1_signe & opt_1_rep & opt_2_and & opt_2_table & opt_2_champ & opt_2_signe & opt_2_rep & opt_3_and & opt_3_table & opt_3_champ & opt_3_signe & opt_3_rep & opt_4_and & opt_4_table & opt_4_champ & opt_4_signe & opt_4_rep & opt_5_and & opt_5_table & opt_5_champ & opt_5_signe & opt_5_rep
Else
End If
End If
End If
End If
End If
End If
End If
MsgBox SQL_Q1P4
'Set oDb = CurrentDb
' Set oRst = oDb.OpenRecordset(SQL_Q0 & SQL_Q2 & SQL_Q4 & SQL_Q1P4 & SQL_Q2P4, dbOpenSnapshot)
' nb_bi = oRst.Fields(0)
'.........................
'oDb.Close
'Set oDb = Nothing
'Set oRst = Nothing
Me.Refresh
End Sub |
Partager