Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Another way you can accomplish this is to add code similar to this in the interactive change of your listbox:
Thisform.ListOfStuff = ""
FOR nCnt = 1 TO THIS.ListCount
IF THIS.Selected(nCnt)
THISFORM.ListOfStuff = Thisform.ListOfStuff + IIF(EMPTY(Thisform.ListOfStuff),"'","','") + THIS.List(nCnt)
ENDIF
ENDFOR
Thisform.ListOfStuff = Thisform.ListOfStuff + "'"
Notice the single quotes surrounded by double quotes. This will store a comma delimited list suitable for macro substitution in your select statement, depending on how many items can possibly be selected. You can then store this property to a variable a place it in an INLIST in your select statement:
ListOfStuff = Thisform.ListOfStuff
SELECT * FROM Somewhere WHERE INLIST(MyField, &ListOfStuff.)
Hope this helps
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement