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
| Private Sub AfficherListe_Click()
'Crée une clause WHERE en utilisant le critère recherche entré par l'utilisateur
'et définit la propriété Source (RecordSource) du Liste_Liste_ToutClub
Dim strMoncritère As String, strMonJeuEnreg As String
Dim intNbrArg As Integer
'Initialise le compteur d'argument.
intNbrArg = 0
'Initialise l'instruction SELECT.
MonSQL = "SELECT * FROM Stade WHERE "
strMoncritère = ""
'Utilise les valeurs entrées dans les zones de texte de l'en-tête de formulaire
'pour créer les critères de la clause WHERE.
If Me!Votre_Choix = 1 Then strMoncritère = "": GoTo Saut01
If Me!Votre_Choix = 2 Then
If Me![UnClub] = "" Then
MsgBox "Vous devez sélectionnez un club", 64, "Erreur"
Me![UnClub].SetFocus
Exit Sub
Else
AjouteràWhere [UnClub], "[Clubs]", strMoncritère, intNbrArg: GoTo Saut01
End If
End If
Saut01:
'Si aucun critère n'est spécifié, renvoie tous les enregistrements.
If strMoncritère = "" Then strMoncritère = "True"
'Crée l'instruction SELECT.
MsgBox strMoncritère, 64, "Choix"
strMonJeuEnreg = MonSQL & strMoncritère & " " & "ORDER BY Stade.Clubs"
'Défini la propriété RecordSource du Liste_Liste_ToutClub.
MsgBox strMonJeuEnreg, 64, "Choix"
Me![Liste_ToutClub].Form.RecordSource = strMonJeuEnreg |