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
| Option Compare Database
Private Sub Commande1_Click()
On Error GoTo Err_Commande1_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Adresses"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_Commande1_Click:
Exit Sub
Err_Commande1_Click:
MsgBox Err.Description
Resume Exit_Commande1_Click
End Sub
__________________________________________________________________________________________________________________________
Private Sub FListe_DblClick(Cancel As Integer)
DoCmd.OpenForm "ProduitsClient"
Forms!ProduitsClient.Filter = "id_ProduitsClient = " & FListe
Forms!ProduitsClient.FilterOn = True
End Sub
__________________________________________________________________________________________________________________________
Private Sub OuvrirProduitClient_Click()
DoCmd.OpenForm "ProduitsClient"
Forms!ProduitsClient.Filter = "id_ProduitsClient = " & FListe
Forms!ProduitsClient.FilterOn = True
End Sub
__________________________________________________________________________________________________________________________
Private Sub chkImmatriculation_Click()
If Me!chkImmatriculation Then
Me!cmbImmatriculation.Visible = False
Else
Me!cmbImmatriculation.Visible = True
End If
RefreshQuery
End Sub
__________________________________________________________________________________________________________________________
Private Sub chkMarque_Click()
If Me!chkMarque Then
Me!cmbMarque.Visible = False
Else
Me!cmbMarque.Visible = True
End If
RefreshQuery
End Sub
__________________________________________________________________________________________________________________________
Private Sub chkNom_Click()
If Me!chkNom Then
Me!txtNom.Visible = False
Else
Me!txtNom.Visible = True
End If
RefreshQuery
End Sub
__________________________________________________________________________________________________________________________
Private Sub chkPrenom_Click()
If Me!chkPrenom Then
Me!txtPrenom.Visible = False
Else
Me!txtPrenom.Visible = True
End If
RefreshQuery
End Sub
__________________________________________________________________________________________________________________________
Private Sub chkTaille_Click()
If Me!chkTaille Then
Me!cmbTaille.Visible = False
Else
Me!cmbTaille.Visible = True
End If
RefreshQuery
End Sub
__________________________________________________________________________________________________________________________
Private Sub cmbMarque_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
__________________________________________________________________________________________________________________________
Private Sub cmbProduit_AfterUpdate()
Dim StrSQL As String, SQLFinal As String
Dim LeWHERE As String, LORDRE As String
StrSQL = "SELECT ProduitsClient.id_ProduitsClient, TypesProduitsClient.TypeProduits, ProduitsClient.Immatriculation, ProduitsClient.Marque, ProduitsClient.Taille, ProduitsClient.Couleur, Clients.Nom, Clients.Prénom " & _
"FROM TypesProduitsClient " & _
"INNER JOIN (Clients INNER JOIN ProduitsClient ON Clients.CodeClient=ProduitsClient.CodeClient) ON TypesProduitsClient.id_TypesProduitsClient=ProduitsClient.id_TypesProduitsClient " & _
""
LeWHERE = "WHERE TypesProduitsClient.TypeProduits= " & Me!cmbProduit
SQLFinal = StrSQL & LeWHERE & ";"
End Sub
__________________________________________________________________________________________________________________________
Private Sub cmbProduit_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
__________________________________________________________________________________________________________________________
Private Sub chkProduit_Click()
If Me!chkProduit Then
Me!cmbProduit.Visible = False
Else
Me!cmbProduit.Visible = True
End If
RefreshQuery
End Sub
__________________________________________________________________________________________________________________________
Private Sub cmbTaille_BeforeUpdate(Cancel As Integer)
RefreshQuery
End Sub
__________________________________________________________________________________________________________________________
Private Sub RefreshQuery()
Dim SQL As String
Dim SQLWhere As String
SQL = "SELECT * " & _
"FROM TailleProduitClient " & _
"INNER JOIN (Marques " & _
"INNER JOIN (Clients " & _
"INNER JOIN (TypesProduitsClient " & _
"INNER JOIN ProduitsClient " & _
"ON TypesProduitsClient.id_TypesProduitsClient = ProduitsClient.id_TypesProduitsClient) " & _
"ON Clients.CodeClient = ProduitsClient.CodeClient) " & _
"ON (TypesProduitsClient.id_TypesProduitsClient = Marques.id_TypesProduitsClient) " & _
"AND (Marques.id_marque = ProduitsClient.id_marque)) " & _
"ON TailleProduitClient.id_taille = ProduitsClient.id_taille;"
If Not Me!chkProduit Then
SQL = SQL & "And ProduitsClient!id_TypesProduitsClient like '*" & Me!cmbProduit & "*' "
End If
If Not Me!chkImmatriculation Then
SQL = SQL & "And ProduitsClient!Immatriculation = '" & Me!txtImmatriculation & "' "
End If
If Not Me!chkMarque Then
SQL = SQL & "And ProduitsClient!id_Marque like '*" & Me!cmbMarque & "*' "
End If
If Not Me!chkTaille Then
SQL = SQL & "And ProduitsClient!id_Taille like '*" & Me!cmbTaille & "*' "
End If
If Not Me!chkNom Then
SQL = SQL & "And Clients!Nom = '" & Me!txtNom & "' "
End If
If Not Me!chkPrenom Then
SQL = SQL & "And Clients!Prénom = '" & Me!txtPrenom & "' "
End If
SQLWhere = Trim(Right(SQL, Len(SQL) - InStr(SQL, "Where ") - Len("Where ") + 1))
SQL = SQL & ";"
Me!lblStats.Caption = DCount("*", "ProduitsClient", SQLWhere) & " / " & DCount("*", "ProduitsClient")
Me!lstResults.RowSource = SQL
Me!lstResults.Requery
End Sub
__________________________________________________________________________________________________________________________
Private Sub Form_Load()
Dim ctl As Control
For Each ctl In Me.Controls
Select Case Left(ctl.Name, 3)
Case "chk"
ctl.Value = -1
Case "lbl"
ctl.Caption = "- * - * -"
Case "txt"
ctl.Visible = False
ctl.Value = ""
Case "cmb"
ctl.Visible = False
End Select
Next ctl
Me!lstResults.RowSource = "SELECT id_ProduitsClient, TypeProduits, Immatriculation, Couleur, Nom, Prénom, Marque, Taille" & _
"FROM TailleProduitClient " & _
"INNER JOIN (Marques " & _
"INNER JOIN (Clients " & _
"INNER JOIN (TypesProduitsClient " & _
"INNER JOIN ProduitsClient " & _
"ON TypesProduitsClient.id_TypesProduitsClient = ProduitsClient.id_TypesProduitsClient) " & _
"ON Clients.CodeClient = ProduitsClient.CodeClient) " & _
"ON (TypesProduitsClient.id_TypesProduitsClient = Marques.id_TypesProduitsClient) " & _
"AND (Marques.id_marque = ProduitsClient.id_marque)) " & _
"ON TailleProduitClient.id_taille = ProduitsClient.id_taille;"
Me!lstResults.Requery
End Sub
__________________________________________________________________________________________________________________________
Private Sub txtImmatriculation_AfterUpdate(Cancel As Integer)
RefreshQuery
End Sub
__________________________________________________________________________________________________________________________
Private Sub txtNom_AfterUpdate(Cancel As Integer)
RefreshQuery
End Sub
__________________________________________________________________________________________________________________________
Private Sub txtPrenom_AfterUpdate(Cancel As Integer)
RefreshQuery
End Sub |
Partager