Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to do a select statement
Message
From
14/09/2000 12:58:37
J Chris Powell
Myers and Stauffer Lc
Kansas, United States
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00416327
Message ID:
00416482
Views:
37
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
Map
View

Click here to load this message in the networking platform