Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using a variable for the rowsource value
Message
From
22/11/2002 13:29:03
Mary Amozig
Software Answers, Inc.
Orlando, Florida, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Using a variable for the rowsource value
Miscellaneous
Thread ID:
00725901
Message ID:
00725901
Views:
46
I am trying to pass conditional variables into a rowsource in a combo box. Basically, what I want to do is adjust the 'where' clause by adding either nothing to it or an ' AND npropid = lnpropid'. I tried using an iif construction in the where clause, but that didn't work. Then I tried doing a 'TEXT TO variable TEXTMERGE' and putting the variable into rowsource, but that didn't work either.

The following is not what I want, but I stripped it down just to see if I could get the rowsource to take a variable at all:

TEXT TO m.cvfpsql TEXTMERGE NOSHOW
SELECT cunitid, nunitid, npropid, nmarkid
FROM c_unitlst
INTO CURSOR test
ENDTEXT

THIS.ROWSOURCE = (m.cvfpsql)

I get an error message "Command is missing required clause."

The following works fine, but does not contain the section I want to add to the where clause:

THIS.ROWSOURCE = ;
"SELECT cunitid, nunitid, npropid, nmarkid ;
FROM c_unitlst ;
INTO CURSOR (THIS.ccursoralias) ;
WHERE 1=1 ;
UNION ;
SELECT ' <>' AS cunitid, 0 AS nunitid, 0 AS npropid, 0 AS nmarkid ;
FROM c_unitlst ;
ORDER BY 1"

Can the rowsource contain a variable for the select statement, and if so, how do you enter it into the rowsource? If it can't, what's the best way to
to adjust the where clause in the select statement based on conditions?

Thank you!

Mary Amozig
Next
Reply
Map
View

Click here to load this message in the networking platform