General information
Category:
Coding, syntax & commands
Title:
Filling listbox programmatically
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
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