Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filling listbox programmatically
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Filling listbox programmatically
Miscellaneous
Thread ID:
00173149
Message ID:
00173149
Views:
64
Hello all,
I'm encountering a syntax error while trying to populate a listbox with an SQL statement. The SQL looks like this:

.cmbRangeFrom.rowsource = "SELECT costcen.dptname FROM costcen WHERE ( &lcWhereClause ) ORDER BY costcen.dptname into cursor ccfrom"

The Whereclause variable is built up programmatically from a for loop based upon the values in a global array. The for loop looks like this:

FOR lnLooper = 1 to THISFORM.listcount
SELECT areaprop
LOCATE for (areaprop->areaname= gaDataAreaArray(lnLooper))
lcAreaId = areaprop->areapro_id
lcWhereClause = lcWhereClause + iif(lnLooper = 1, "", " OR ") + ;
"costcen.area_id = " + "'" + lcAreaId + "'"
ENDFOR

But there's a catch. If the number of elements OR'd together in the where clause is less than or equal to five, this select works fine. However, when the number is greater than five, I encounter the syntax error. Any ideas?

Thanks!
Next
Reply
Map
View

Click here to load this message in the networking platform