Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Désélectionner les valeurs d'une zone de liste à sélection multi pl

7 réponses
Avatar
Gabriel Racine
Bonjour,

Je me suis créé un formulaire qui me permet la sélection multiple en
cascade. Je me suis installé des cases à cocher qui permettent de
sélectionner toutes mes valeurs dans la zone de liste à laquelle elle est
relié. Lorsque je clique dessus, toutes mes valeurs de ma zone de liste sont
sélectionnés. Par contre, je voudrais être en mesure que lorsque je
désélectionne ma case à cocher, celle-ci désélectionne toutes mes valeurs
dans ma zone de liste. Quelqu'un a-t-il une idée sur comment écrire ça en
VBA? Voici un exemple du code qui sélectionne tout!

Private Sub cmdSelectAll_Click()
Dim i As Long
For i = 0 To Me.lstRes.ListCount - 1
Me.lstRes.Selected(i) = True
Next i
End Sub


Merci D'avance

--
Gabriel Racine

7 réponses

Avatar
Raymond [mvp]
Bonsoir.

Tu fais pareil en sens contraire:

Private Sub cmdSelectAll_Click()
Dim I As Long
For I = 0 To Me.lstRes.ListCount - 1
Me.lstRes.Selected(I) = True
Next I
End Sub
-------------------------------------------------------------------
Private Sub cmdUnSelectAll_Click()
Dim I As Variant
For Each I In Me.lstRes.ItemsSelected
Me!lstRes.Selected(I) = False
Next I
End Sub

ou

Private Sub cmdUnSelectAll_Click()
Dim I As Long
For I = 0 To Me.lstRes.ListCount - 1
Me.lstRes.Selected(I) = False
Next I
End Sub

--
@+
Raymond Access MVP http://www.OfficeSystemAccess.com/
http://officesystem.access.over-blog.com/
http://officesystem.access.free.fr/wiki/
Pour débuter sur le forum: http://www.mpfa.info/

Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99


"Gabriel Racine" a écrit dans le message de news:

| Bonjour,
|
| Je me suis créé un formulaire qui me permet la sélection multiple en
| cascade. Je me suis installé des cases à cocher qui permettent de
| sélectionner toutes mes valeurs dans la zone de liste à laquelle elle est
| relié. Lorsque je clique dessus, toutes mes valeurs de ma zone de liste
sont
| sélectionnés. Par contre, je voudrais être en mesure que lorsque je
| désélectionne ma case à cocher, celle-ci désélectionne toutes mes valeurs
| dans ma zone de liste. Quelqu'un a-t-il une idée sur comment écrire ça en
| VBA? Voici un exemple du code qui sélectionne tout!
|
| Private Sub cmdSelectAll_Click()
| Dim i As Long
| For i = 0 To Me.lstRes.ListCount - 1
| Me.lstRes.Selected(i) = True
| Next i
| End Sub
|
|
| Merci D'avance
|
| --
| Gabriel Racine
Avatar
Gabriel Racine
C'est bon, ca fonctionne sauf que lorsque quand je mets ceci dans mon code,
il sélectionne tout et désélectionne tout en même temps :S. En fait, voici ce
que je veux qui se produise quand je clique sur ma case à cocher :

Private Sub CocherSous_Segments_Click()

DoCmd.SetWarnings False

DoCmd.RunSQL "DELETE * FROM Tbl_Qry_SousSegment"
DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Skue"
DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Zone"
DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Réseau"
DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Date"

For I = 0 To Liste4.ListCount - 1
Liste4.Selected(I) = True
DoCmd.RunSQL "INSERT INTO Tbl_Qry_SousSegment SELECT
tbl_Qry_Segment.* FROM tbl_Qry_Segment WHERE (false) OR
(tbl_Qry_Segment.SousSegment='" & Liste4.Column(0, I) & "');"

Next

Liste0.Requery

DoCmd.SetWarnings True

Liste6.Requery
Liste10.Requery
Liste12.Requery
Liste14.Requery

End Sub

Ensuite, je voudrais qu'en désélectionnant la case à cocher, celle-ci fasse
le contraire. Sauriez-vous comment?

Cordialement,

--
Gabriel Racine



Bonsoir.

Tu fais pareil en sens contraire:

Private Sub cmdSelectAll_Click()
Dim I As Long
For I = 0 To Me.lstRes.ListCount - 1
Me.lstRes.Selected(I) = True
Next I
End Sub
-------------------------------------------------------------------
Private Sub cmdUnSelectAll_Click()
Dim I As Variant
For Each I In Me.lstRes.ItemsSelected
Me!lstRes.Selected(I) = False
Next I
End Sub

ou

Private Sub cmdUnSelectAll_Click()
Dim I As Long
For I = 0 To Me.lstRes.ListCount - 1
Me.lstRes.Selected(I) = False
Next I
End Sub

--
@+
Raymond Access MVP http://www.OfficeSystemAccess.com/
http://officesystem.access.over-blog.com/
http://officesystem.access.free.fr/wiki/
Pour débuter sur le forum: http://www.mpfa.info/

Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99


"Gabriel Racine" a écrit dans le message de news:

| Bonjour,
|
| Je me suis créé un formulaire qui me permet la sélection multiple en
| cascade. Je me suis installé des cases à cocher qui permettent de
| sélectionner toutes mes valeurs dans la zone de liste à laquelle elle est
| relié. Lorsque je clique dessus, toutes mes valeurs de ma zone de liste
sont
| sélectionnés. Par contre, je voudrais être en mesure que lorsque je
| désélectionne ma case à cocher, celle-ci désélectionne toutes mes valeurs
| dans ma zone de liste. Quelqu'un a-t-il une idée sur comment écrire ça en
| VBA? Voici un exemple du code qui sélectionne tout!
|
| Private Sub cmdSelectAll_Click()
| Dim i As Long
| For i = 0 To Me.lstRes.ListCount - 1
| Me.lstRes.Selected(i) = True
| Next i
| End Sub
|
|
| Merci D'avance
|
| --
| Gabriel Racine





Avatar
Raymond [mvp]
Bonjour.

je ne comprends pas.

tu fais des requêtes ajout dans une autre table, très bien. mais le
contraire c'est quoi ? c'est supprimer ? mais quoi ?

--
@+
Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/

Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99


"Gabriel Racine" a écrit dans le message de news:

| C'est bon, ca fonctionne sauf que lorsque quand je mets ceci dans mon
code,
| il sélectionne tout et désélectionne tout en même temps :S. En fait, voici
ce
| que je veux qui se produise quand je clique sur ma case à cocher :
|
| Private Sub CocherSous_Segments_Click()
|
| DoCmd.SetWarnings False
|
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_SousSegment"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Skue"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Zone"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Réseau"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Date"
|
| For I = 0 To Liste4.ListCount - 1
| Liste4.Selected(I) = True
| DoCmd.RunSQL "INSERT INTO Tbl_Qry_SousSegment SELECT
| tbl_Qry_Segment.* FROM tbl_Qry_Segment WHERE (false) OR
| (tbl_Qry_Segment.SousSegment='" & Liste4.Column(0, I) & "');"
|
| Next
|
| Liste0.Requery
|
| DoCmd.SetWarnings True
|
| Liste6.Requery
| Liste10.Requery
| Liste12.Requery
| Liste14.Requery
|
| End Sub
|
| Ensuite, je voudrais qu'en désélectionnant la case à cocher, celle-ci
fasse
| le contraire. Sauriez-vous comment?
|
| Cordialement,
|
| --
| Gabriel Racine
|
|
|
| > Bonsoir.
| >
| > Tu fais pareil en sens contraire:
| >
| > Private Sub cmdSelectAll_Click()
| > Dim I As Long
| > For I = 0 To Me.lstRes.ListCount - 1
| > Me.lstRes.Selected(I) = True
| > Next I
| > End Sub
| > -------------------------------------------------------------------
| > Private Sub cmdUnSelectAll_Click()
| > Dim I As Variant
| > For Each I In Me.lstRes.ItemsSelected
| > Me!lstRes.Selected(I) = False
| > Next I
| > End Sub
| >
| > ou
| >
| > Private Sub cmdUnSelectAll_Click()
| > Dim I As Long
| > For I = 0 To Me.lstRes.ListCount - 1
| > Me.lstRes.Selected(I) = False
| > Next I
| > End Sub
| >
| > --
| > @+
| > Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
| > http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
| > http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
| > Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/
| >
| > Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
| >
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99
| >
| >
| > "Gabriel Racine" a écrit dans le message de
news:
| >
| > | Bonjour,
| > |
| > | Je me suis créé un formulaire qui me permet la sélection multiple en
| > | cascade. Je me suis installé des cases à cocher qui permettent de
| > | sélectionner toutes mes valeurs dans la zone de liste à laquelle elle
est
| > | relié. Lorsque je clique dessus, toutes mes valeurs de ma zone de
liste
| > sont
| > | sélectionnés. Par contre, je voudrais être en mesure que lorsque je
| > | désélectionne ma case à cocher, celle-ci désélectionne toutes mes
valeurs
| > | dans ma zone de liste. Quelqu'un a-t-il une idée sur comment écrire ça
en
| > | VBA? Voici un exemple du code qui sélectionne tout!
| > |
| > | Private Sub cmdSelectAll_Click()
| > | Dim i As Long
| > | For i = 0 To Me.lstRes.ListCount - 1
| > | Me.lstRes.Selected(i) = True
| > | Next i
| > | End Sub
| > |
| > |
| > | Merci D'avance
| > |
| > | --
| > | Gabriel Racine
| >
| >
| >
Avatar
Gabriel Racine
En fait, dans chacune de mes zone de liste, chaque fois que je sélectionne
quelque chose dedans, celle ci supprime la table à laquelle elle est relié.
Ensuite, elle ajoute dans cette même table tous les éléments de la table
précédente, mais pour WHERE les éléments sélectionnés dans ma liste.

Donc je suppose que lorsque je clique à l'intérieur de ma case à cocher,
celle ci fait ce code, et quand je décoche, celle-ci désélectionne toute les
valeurs dans la zone de liste et Supprime les tables en question.

Dans le fond, je veux seulement etre en mesure d'alterner le code quand je
sélectionne et désélectionne la case à cocher.
--
Gabriel Racine



Bonjour.

je ne comprends pas.

tu fais des requêtes ajout dans une autre table, très bien. mais le
contraire c'est quoi ? c'est supprimer ? mais quoi ?

--
@+
Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/

Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99


"Gabriel Racine" a écrit dans le message de news:

| C'est bon, ca fonctionne sauf que lorsque quand je mets ceci dans mon
code,
| il sélectionne tout et désélectionne tout en même temps :S. En fait, voici
ce
| que je veux qui se produise quand je clique sur ma case à cocher :
|
| Private Sub CocherSous_Segments_Click()
|
| DoCmd.SetWarnings False
|
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_SousSegment"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Skue"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Zone"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Réseau"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Date"
|
| For I = 0 To Liste4.ListCount - 1
| Liste4.Selected(I) = True
| DoCmd.RunSQL "INSERT INTO Tbl_Qry_SousSegment SELECT
| tbl_Qry_Segment.* FROM tbl_Qry_Segment WHERE (false) OR
| (tbl_Qry_Segment.SousSegment='" & Liste4.Column(0, I) & "');"
|
| Next
|
| Liste0.Requery
|
| DoCmd.SetWarnings True
|
| Liste6.Requery
| Liste10.Requery
| Liste12.Requery
| Liste14.Requery
|
| End Sub
|
| Ensuite, je voudrais qu'en désélectionnant la case à cocher, celle-ci
fasse
| le contraire. Sauriez-vous comment?
|
| Cordialement,
|
| --
| Gabriel Racine
|
|
|
| > Bonsoir.
| >
| > Tu fais pareil en sens contraire:
| >
| > Private Sub cmdSelectAll_Click()
| > Dim I As Long
| > For I = 0 To Me.lstRes.ListCount - 1
| > Me.lstRes.Selected(I) = True
| > Next I
| > End Sub
| > -------------------------------------------------------------------
| > Private Sub cmdUnSelectAll_Click()
| > Dim I As Variant
| > For Each I In Me.lstRes.ItemsSelected
| > Me!lstRes.Selected(I) = False
| > Next I
| > End Sub
| >
| > ou
| >
| > Private Sub cmdUnSelectAll_Click()
| > Dim I As Long
| > For I = 0 To Me.lstRes.ListCount - 1
| > Me.lstRes.Selected(I) = False
| > Next I
| > End Sub
| >
| > --
| > @+
| > Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
| > http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
| > http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
| > Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/
| >
| > Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
| >
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99
| >
| >
| > "Gabriel Racine" a écrit dans le message de
news:
| >
| > | Bonjour,
| > |
| > | Je me suis créé un formulaire qui me permet la sélection multiple en
| > | cascade. Je me suis installé des cases à cocher qui permettent de
| > | sélectionner toutes mes valeurs dans la zone de liste à laquelle elle
est
| > | relié. Lorsque je clique dessus, toutes mes valeurs de ma zone de
liste
| > sont
| > | sélectionnés. Par contre, je voudrais être en mesure que lorsque je
| > | désélectionne ma case à cocher, celle-ci désélectionne toutes mes
valeurs
| > | dans ma zone de liste. Quelqu'un a-t-il une idée sur comment écrire ça
en
| > | VBA? Voici un exemple du code qui sélectionne tout!
| > |
| > | Private Sub cmdSelectAll_Click()
| > | Dim i As Long
| > | For i = 0 To Me.lstRes.ListCount - 1
| > | Me.lstRes.Selected(i) = True
| > | Next i
| > | End Sub
| > |
| > |
| > | Merci D'avance
| > |
| > | --
| > | Gabriel Racine
| >
| >
| >





Avatar
Gabriel Racine
En fait, si je m'exprime autrement, voici le code que je veux. Il s'exécute
parfaitement, mais il fait tout en même temps. Je veux seulement que lorsque
je sélectionne ma case à cocher celle-ci exécute une requête Ajout selon les
items sélectionnés dans ma zone de liste, et lorsque je désélectionne ma case
à cocher, celle-ci désélectionne toute ma zone de liste et Exécute une
Requête suppression.

Private Sub CocherSous_Segments_Click()

DoCmd.SetWarnings False

DoCmd.RunSQL "DELETE * FROM Tbl_Qry_SousSegment"

For I = 0 To Liste4.ListCount - 1
Liste4.Selected(I) = True
DoCmd.RunSQL "INSERT INTO Tbl_Qry_SousSegment SELECT
tbl_Qry_Segment.* FROM tbl_Qry_Segment WHERE (false) OR
(tbl_Qry_Segment.SousSegment='" & Liste4.Column(0, I) & "');"

Next

For Each I In Liste4.ItemsSelected
If Liste4.Selected(I) = True Then
Liste4.Selected(I) = False
End If

Next I

DoCmd.SetWarnings True

Liste6.Requery

End Sub
--
Gabriel Racine



Bonjour.

je ne comprends pas.

tu fais des requêtes ajout dans une autre table, très bien. mais le
contraire c'est quoi ? c'est supprimer ? mais quoi ?

--
@+
Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/

Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99


"Gabriel Racine" a écrit dans le message de news:

| C'est bon, ca fonctionne sauf que lorsque quand je mets ceci dans mon
code,
| il sélectionne tout et désélectionne tout en même temps :S. En fait, voici
ce
| que je veux qui se produise quand je clique sur ma case à cocher :
|
| Private Sub CocherSous_Segments_Click()
|
| DoCmd.SetWarnings False
|
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_SousSegment"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Skue"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Zone"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Réseau"
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Date"
|
| For I = 0 To Liste4.ListCount - 1
| Liste4.Selected(I) = True
| DoCmd.RunSQL "INSERT INTO Tbl_Qry_SousSegment SELECT
| tbl_Qry_Segment.* FROM tbl_Qry_Segment WHERE (false) OR
| (tbl_Qry_Segment.SousSegment='" & Liste4.Column(0, I) & "');"
|
| Next
|
| Liste0.Requery
|
| DoCmd.SetWarnings True
|
| Liste6.Requery
| Liste10.Requery
| Liste12.Requery
| Liste14.Requery
|
| End Sub
|
| Ensuite, je voudrais qu'en désélectionnant la case à cocher, celle-ci
fasse
| le contraire. Sauriez-vous comment?
|
| Cordialement,
|
| --
| Gabriel Racine
|
|
|
| > Bonsoir.
| >
| > Tu fais pareil en sens contraire:
| >
| > Private Sub cmdSelectAll_Click()
| > Dim I As Long
| > For I = 0 To Me.lstRes.ListCount - 1
| > Me.lstRes.Selected(I) = True
| > Next I
| > End Sub
| > -------------------------------------------------------------------
| > Private Sub cmdUnSelectAll_Click()
| > Dim I As Variant
| > For Each I In Me.lstRes.ItemsSelected
| > Me!lstRes.Selected(I) = False
| > Next I
| > End Sub
| >
| > ou
| >
| > Private Sub cmdUnSelectAll_Click()
| > Dim I As Long
| > For I = 0 To Me.lstRes.ListCount - 1
| > Me.lstRes.Selected(I) = False
| > Next I
| > End Sub
| >
| > --
| > @+
| > Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
| > http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
| > http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
| > Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/
| >
| > Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
| >
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99
| >
| >
| > "Gabriel Racine" a écrit dans le message de
news:
| >
| > | Bonjour,
| > |
| > | Je me suis créé un formulaire qui me permet la sélection multiple en
| > | cascade. Je me suis installé des cases à cocher qui permettent de
| > | sélectionner toutes mes valeurs dans la zone de liste à laquelle elle
est
| > | relié. Lorsque je clique dessus, toutes mes valeurs de ma zone de
liste
| > sont
| > | sélectionnés. Par contre, je voudrais être en mesure que lorsque je
| > | désélectionne ma case à cocher, celle-ci désélectionne toutes mes
valeurs
| > | dans ma zone de liste. Quelqu'un a-t-il une idée sur comment écrire ça
en
| > | VBA? Voici un exemple du code qui sélectionne tout!
| > |
| > | Private Sub cmdSelectAll_Click()
| > | Dim i As Long
| > | For i = 0 To Me.lstRes.ListCount - 1
| > | Me.lstRes.Selected(i) = True
| > | Next i
| > | End Sub
| > |
| > |
| > | Merci D'avance
| > |
| > | --
| > | Gabriel Racine
| >
| >
| >





Avatar
Raymond [mvp]
d'abord il ne faut pas prendre l'événement Click mais l'événement
afterupdate pour être su^r que l'état de la case a bien changé.
dans le principe ça va donner ça:
Private Sub CocherSous_Segments_AfterUpdate()
Dim I As Integer
If Me.CocherSous_Segments Then
' si coché
DoCmd.RunSQL "DELETE * FROM Tbl_Qry_SousSegment"
For I = 0 To Liste4.ListCount - 1
Liste4.Selected(I) = True
DoCmd.RunSQL "INSERT INTO .................
Else
' si décoché
For Each I In Liste4.ItemsSelected
Liste4.Selected(I) = False
Next I
End If
End Sub

à toi de rajouter ton code exact et complémentaire.
--
@+
Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/

Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99


"Gabriel Racine" a écrit dans le message de news:

| En fait, si je m'exprime autrement, voici le code que je veux. Il
s'exécute
| parfaitement, mais il fait tout en même temps. Je veux seulement que
lorsque
| je sélectionne ma case à cocher celle-ci exécute une requête Ajout selon
les
| items sélectionnés dans ma zone de liste, et lorsque je désélectionne ma
case
| à cocher, celle-ci désélectionne toute ma zone de liste et Exécute une
| Requête suppression.
|
| Private Sub CocherSous_Segments_Click()
|
| DoCmd.SetWarnings False
|
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_SousSegment"
|
| For I = 0 To Liste4.ListCount - 1
| Liste4.Selected(I) = True
| DoCmd.RunSQL "INSERT INTO Tbl_Qry_SousSegment SELECT
| tbl_Qry_Segment.* FROM tbl_Qry_Segment WHERE (false) OR
| (tbl_Qry_Segment.SousSegment='" & Liste4.Column(0, I) & "');"
|
| Next
|
| For Each I In Liste4.ItemsSelected
| If Liste4.Selected(I) = True Then
| Liste4.Selected(I) = False
| End If
|
| Next I
|
| DoCmd.SetWarnings True
|
| Liste6.Requery
|
| End Sub
| --
| Gabriel Racine
|
|
|
| > Bonjour.
| >
| > je ne comprends pas.
| >
| > tu fais des requêtes ajout dans une autre table, très bien. mais le
| > contraire c'est quoi ? c'est supprimer ? mais quoi ?
| >
| > --
| > @+
| > Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
| > http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
| > http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
| > Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/
| >
| > Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
| >
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99
| >
| >
| > "Gabriel Racine" a écrit dans le message de
news:
| >
| > | C'est bon, ca fonctionne sauf que lorsque quand je mets ceci dans mon
| > code,
| > | il sélectionne tout et désélectionne tout en même temps :S. En fait,
voici
| > ce
| > | que je veux qui se produise quand je clique sur ma case à cocher :
| > |
| > | Private Sub CocherSous_Segments_Click()
| > |
| > | DoCmd.SetWarnings False
| > |
| > | DoCmd.RunSQL "DELETE * FROM Tbl_Qry_SousSegment"
| > | DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Skue"
| > | DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Zone"
| > | DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Réseau"
| > | DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Date"
| > |
| > | For I = 0 To Liste4.ListCount - 1
| > | Liste4.Selected(I) = True
| > | DoCmd.RunSQL "INSERT INTO Tbl_Qry_SousSegment SELECT
| > | tbl_Qry_Segment.* FROM tbl_Qry_Segment WHERE (false) OR
| > | (tbl_Qry_Segment.SousSegment='" & Liste4.Column(0, I) & "');"
| > |
| > | Next
| > |
| > | Liste0.Requery
| > |
| > | DoCmd.SetWarnings True
| > |
| > | Liste6.Requery
| > | Liste10.Requery
| > | Liste12.Requery
| > | Liste14.Requery
| > |
| > | End Sub
| > |
| > | Ensuite, je voudrais qu'en désélectionnant la case à cocher, celle-ci
| > fasse
| > | le contraire. Sauriez-vous comment?
| > |
| > | Cordialement,
| > |
| > | --
| > | Gabriel Racine
| > |
| > |
| > |
| > | > Bonsoir.
| > | >
| > | > Tu fais pareil en sens contraire:
| > | >
| > | > Private Sub cmdSelectAll_Click()
| > | > Dim I As Long
| > | > For I = 0 To Me.lstRes.ListCount - 1
| > | > Me.lstRes.Selected(I) = True
| > | > Next I
| > | > End Sub
| > | > -------------------------------------------------------------------
| > | > Private Sub cmdUnSelectAll_Click()
| > | > Dim I As Variant
| > | > For Each I In Me.lstRes.ItemsSelected
| > | > Me!lstRes.Selected(I) = False
| > | > Next I
| > | > End Sub
| > | >
| > | > ou
| > | >
| > | > Private Sub cmdUnSelectAll_Click()
| > | > Dim I As Long
| > | > For I = 0 To Me.lstRes.ListCount - 1
| > | > Me.lstRes.Selected(I) = False
| > | > Next I
| > | > End Sub
| > | >
| > | > --
| > | > @+
| > | > Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
| > | > http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
| > | > http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
| > | > Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/
| > | >
| > | > Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
| > | >
| >
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99
| > | >
| > | >
| > | > "Gabriel Racine" a écrit dans le message de
| > news:
| > | >
| > | > | Bonjour,
| > | > |
| > | > | Je me suis créé un formulaire qui me permet la sélection multiple
en
| > | > | cascade. Je me suis installé des cases à cocher qui permettent de
| > | > | sélectionner toutes mes valeurs dans la zone de liste à laquelle
elle
| > est
| > | > | relié. Lorsque je clique dessus, toutes mes valeurs de ma zone de
| > liste
| > | > sont
| > | > | sélectionnés. Par contre, je voudrais être en mesure que lorsque
je
| > | > | désélectionne ma case à cocher, celle-ci désélectionne toutes mes
| > valeurs
| > | > | dans ma zone de liste. Quelqu'un a-t-il une idée sur comment
écrire ça
| > en
| > | > | VBA? Voici un exemple du code qui sélectionne tout!
| > | > |
| > | > | Private Sub cmdSelectAll_Click()
| > | > | Dim i As Long
| > | > | For i = 0 To Me.lstRes.ListCount - 1
| > | > | Me.lstRes.Selected(i) = True
| > | > | Next i
| > | > | End Sub
| > | > |
| > | > |
| > | > | Merci D'avance
| > | > |
| > | > | --
| > | > | Gabriel Racine
| > | >
| > | >
| > | >
| >
| >
| >
Avatar
Gabriel Racine
Parfait, merci à toi!!
--
Gabriel Racine



d'abord il ne faut pas prendre l'événement Click mais l'événement
afterupdate pour être su^r que l'état de la case a bien changé.
dans le principe ça va donner ça:
Private Sub CocherSous_Segments_AfterUpdate()
Dim I As Integer
If Me.CocherSous_Segments Then
' si coché
DoCmd.RunSQL "DELETE * FROM Tbl_Qry_SousSegment"
For I = 0 To Liste4.ListCount - 1
Liste4.Selected(I) = True
DoCmd.RunSQL "INSERT INTO .................
Else
' si décoché
For Each I In Liste4.ItemsSelected
Liste4.Selected(I) = False
Next I
End If
End Sub

à toi de rajouter ton code exact et complémentaire.
--
@+
Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/

Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99


"Gabriel Racine" a écrit dans le message de news:

| En fait, si je m'exprime autrement, voici le code que je veux. Il
s'exécute
| parfaitement, mais il fait tout en même temps. Je veux seulement que
lorsque
| je sélectionne ma case à cocher celle-ci exécute une requête Ajout selon
les
| items sélectionnés dans ma zone de liste, et lorsque je désélectionne ma
case
| à cocher, celle-ci désélectionne toute ma zone de liste et Exécute une
| Requête suppression.
|
| Private Sub CocherSous_Segments_Click()
|
| DoCmd.SetWarnings False
|
| DoCmd.RunSQL "DELETE * FROM Tbl_Qry_SousSegment"
|
| For I = 0 To Liste4.ListCount - 1
| Liste4.Selected(I) = True
| DoCmd.RunSQL "INSERT INTO Tbl_Qry_SousSegment SELECT
| tbl_Qry_Segment.* FROM tbl_Qry_Segment WHERE (false) OR
| (tbl_Qry_Segment.SousSegment='" & Liste4.Column(0, I) & "');"
|
| Next
|
| For Each I In Liste4.ItemsSelected
| If Liste4.Selected(I) = True Then
| Liste4.Selected(I) = False
| End If
|
| Next I
|
| DoCmd.SetWarnings True
|
| Liste6.Requery
|
| End Sub
| --
| Gabriel Racine
|
|
|
| > Bonjour.
| >
| > je ne comprends pas.
| >
| > tu fais des requêtes ajout dans une autre table, très bien. mais le
| > contraire c'est quoi ? c'est supprimer ? mais quoi ?
| >
| > --
| > @+
| > Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
| > http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
| > http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
| > Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/
| >
| > Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
| >
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99
| >
| >
| > "Gabriel Racine" a écrit dans le message de
news:
| >
| > | C'est bon, ca fonctionne sauf que lorsque quand je mets ceci dans mon
| > code,
| > | il sélectionne tout et désélectionne tout en même temps :S. En fait,
voici
| > ce
| > | que je veux qui se produise quand je clique sur ma case à cocher :
| > |
| > | Private Sub CocherSous_Segments_Click()
| > |
| > | DoCmd.SetWarnings False
| > |
| > | DoCmd.RunSQL "DELETE * FROM Tbl_Qry_SousSegment"
| > | DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Skue"
| > | DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Zone"
| > | DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Réseau"
| > | DoCmd.RunSQL "DELETE * FROM Tbl_Qry_Date"
| > |
| > | For I = 0 To Liste4.ListCount - 1
| > | Liste4.Selected(I) = True
| > | DoCmd.RunSQL "INSERT INTO Tbl_Qry_SousSegment SELECT
| > | tbl_Qry_Segment.* FROM tbl_Qry_Segment WHERE (false) OR
| > | (tbl_Qry_Segment.SousSegment='" & Liste4.Column(0, I) & "');"
| > |
| > | Next
| > |
| > | Liste0.Requery
| > |
| > | DoCmd.SetWarnings True
| > |
| > | Liste6.Requery
| > | Liste10.Requery
| > | Liste12.Requery
| > | Liste14.Requery
| > |
| > | End Sub
| > |
| > | Ensuite, je voudrais qu'en désélectionnant la case à cocher, celle-ci
| > fasse
| > | le contraire. Sauriez-vous comment?
| > |
| > | Cordialement,
| > |
| > | --
| > | Gabriel Racine
| > |
| > |
| > |
| > | > Bonsoir.
| > | >
| > | > Tu fais pareil en sens contraire:
| > | >
| > | > Private Sub cmdSelectAll_Click()
| > | > Dim I As Long
| > | > For I = 0 To Me.lstRes.ListCount - 1
| > | > Me.lstRes.Selected(I) = True
| > | > Next I
| > | > End Sub
| > | > -------------------------------------------------------------------
| > | > Private Sub cmdUnSelectAll_Click()
| > | > Dim I As Variant
| > | > For Each I In Me.lstRes.ItemsSelected
| > | > Me!lstRes.Selected(I) = False
| > | > Next I
| > | > End Sub
| > | >
| > | > ou
| > | >
| > | > Private Sub cmdUnSelectAll_Click()
| > | > Dim I As Long
| > | > For I = 0 To Me.lstRes.ListCount - 1
| > | > Me.lstRes.Selected(I) = False
| > | > Next I
| > | > End Sub
| > | >
| > | > --
| > | > @+
| > | > Raymond Access MVP http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.OfficeSystemAccess.com/
| > | > http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.over-blog.com/
| > | > http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://officesystem.access.free.fr/wiki/
| > | > Pour débuter sur le forum: http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.mpfa.info/
| > | >
| > | > Cet été, j'en ai rien à coder, je me forme : les devoirs de vacances
| > | >
| >
http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99" target="_blank" class="text-blue hover:opacity-90 " style="word-break: break-all;" rel="noopener nofollow">http://www.comscamp.com/Tracker/Redirect.ashx?linkidJd96883-a859-4212-b4a0-bce47c8e0d99
| > | >
| > | >
| > | > "Gabriel Racine" a écrit dans le message de
| > news:
| > | >
| > | > | Bonjour,
| > | > |
| > | > | Je me suis créé un formulaire qui me permet la sélection multiple
en
| > | > | cascade. Je me suis installé des cases à cocher qui permettent de
| > | > | sélectionner toutes mes valeurs dans la zone de liste à laquelle
elle
| > est
| > | > | relié. Lorsque je clique dessus, toutes mes valeurs de ma zone de
| > liste
| > | > sont
| > | > | sélectionnés. Par contre, je voudrais être en mesure que lorsque
je
| > | > | désélectionne ma case à cocher, celle-ci désélectionne toutes mes
| > valeurs
| > | > | dans ma zone de liste. Quelqu'un a-t-il une idée sur comment
écrire ça
| > en
| > | > | VBA? Voici un exemple du code qui sélectionne tout!
| > | > |
| > | > | Private Sub cmdSelectAll_Click()
| > | > | Dim i As Long
| > | > | For i = 0 To Me.lstRes.ListCount - 1
| > | > | Me.lstRes.Selected(i) = True
| > | > | Next i
| > | > | End Sub
| > | > |
| > | > |
| > | > | Merci D'avance
| > | > |
| > | > | --
| > | > | Gabriel Racine
| > | >
| > | >
| > | >
| >
| >
| >