>I'm want my users to select the data for processing, and am providing forms to allow them to enter their data selections. The generated SQL select is longer than 254 characters, so I have segmented it and placed it into a memo field in a cursor. I was trying to issue "&mycursor.myselect", but that won't work.
>
>How can I create the SQL select at runtime and execute it without VFP being installed on the user's system?
>
Harry,
The 254 characters limit is for a string literal only. The limit for any VFP commnad including SQL SELECT is 8,192 bytes. You can use EXECSCRIPT() to run code
EXECSCRIPT(mycursor.myselect)
lcSQL = CHRTRAN(mycursor.myselect, CHR(13)+CHR(10),"")
&lcSQL
You can also use TEXTMERGE to build a query. It makes code more readable. Something like
TEXT TO lcSQL TEXTMERGE NOSHOW PRETEXT 7
SELECT * FROM Products
WHERE eng_name = "<<Thisform.txtProdName>>"
ENDTEXT
lcSQL = CHRTRAN(lcSQL, CHR(13)+CHR(10),"")
&lcSQL
--sb--