General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
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
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only