Comment dois-je m'y prendre pour les conditions ??
where Champ= me.list ?????????
-------------------------------
Réponse au message :
-------------------------------
> Tu utilise a ado
>
> -avec un recordset
>
> with rs
> strsql="SELECT Include FROM TABLE WHERE Condition"
> .activeconnection=cn.connectionstring
> .open strsql
> if .recordcount=1 then
> !Include=true
> .update
> end if
> .close
> end with
>
>
> -avec un objet command
>
> with rs
> strsql="Insert into nom_table SET include=true WHERE Condition"
> .activeconnection=cn.connectionstring
> .commandtext=strsql
>
> .execute
> end with
>
> Pour trier ta liste, tu as la propriété sorted
>
>
Florent>
>
> -------------------------------
> Réponse au message :
> -------------------------------
>
> > Pour sélectionner les enregistrements qui remplissent List1, j'utilise ça (avec le DataEnvironnement-DE)
> >
> >
> > > > DE.SelectCat > > With DE.rsSelectCat > > .MoveFirst > > Do Until .EOF > > FrmListe_chxcat.selection.AddItem !Definition > > .MoveNext > > Loop > > .Close > > End With > > |
> >
> >
> > pour remplir List2 grâce à List1, j'utilise ça (récupéré sur VBFrance !!Merci)
> >
> > > > ____________________________________________ > > Private Sub cmdselect_Click() > > Dim BoxFrom, BoxTo As Object > > Set BoxFrom = Me.selection > > Set BoxTo = Me.choix > > SortList BoxFrom, BoxTo > > > > End Sub > > _____________________________________________ > > Function SortList(BoxFrom, BoxTo) > > Dim item As String > > Dim i As Integer, j As Long > > Dim counti As String > > Dim comp As String > > If BoxFrom.ListIndex = -1 Then > > Exit Function > > Else > > item = BoxFrom.Text > > If BoxTo.ListCount = 0 Then > > BoxTo.AddItem item, i > > BoxFrom.RemoveItem BoxFrom.ListIndex > > Else > > BoxTo.AddItem item > > BoxFrom.RemoveItem BoxFrom.ListIndex > > counti = BoxTo.ListCount - 1 > > > > For i = counti To 0 Step -1 > > For j = i - 1 To 0 Step -1 > > item = BoxTo.List(j) > > comp = BoxTo.List(i) > > If item > comp Then > > BoxTo.RemoveItem j > > BoxTo.AddItem item, i > > End If > > Next j > > Next i > > End If > > End If > > End Function > > ___________________________________________ > > Private Sub Form_Load() > > Call AffichageCat > > End Sub > > |
> >
> > __________________________________________
> > ___________________________________
> > ________________________
> > Mais d'habitude, pour accèder à une table, j'utilise une requête SQL dans mon programme VB style :
> >
> >
> >
> > Set AdoConnection = New ADODB.Connection > > Set AdoRecordset = New ADODB.Recordset > > > > ConnectString = "Immo" > > AdoConnection.Open ConnectString > > > > SQL = "SELECT blabla FROM blabla where blabla" > > > > AdoRecordset.Open SQL, AdoConnection > > |
> >
> > -------------------------------
> > Réponse au message :
> > -------------------------------
> >
> > > en fait c'est au moment que tu ajoute ton élément dans ta list2, qu'il faut updrader ton champ Include
> > > tu utilise qu'elle méthode pour accéder à ta base
> > >
> > > et inversement pour la suppression
> > >
Florent> > >
> > >
> > > -------------------------------
> > > Réponse au message :
> > > -------------------------------
> > >
> > > > Bonjour
> > > >
> > > > alors voila :
> > > >
> > > > j'ai deux ListBox dans mon Form, appelons les List1 et List2.
> > > >
> > > > Je rempli List1 avec les éléments d'une table. Grâce à un bouton cmdSelect, l'utilisateur choisi un ou des éléments de List1 qui vont remplir List2....jusque là, rien de compliqué !
> > > >
> > > > Dans ma table Access, j'ai un champ Include initialisé à FAUX
> > > >
> > > > et bien j'aimerai qu'à partir de ma List2, mon champ Include inscrive VRAI en fonction des éléments de List2 ....
> > > >
> > > > Je vous remercie d'avance !!
> > >
> >
>