Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Search Conditions
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00810105
Message ID:
00810123
Views:
12
Absolutely right - I guess that I got bogged down in the rather strange construction of the case statement that I just corrected it without thinking about what it was actually doing!
The resulting code is quite simple
lcwhere="modacad.key3"+thisform.combo1.displayvalue+"thisform.textbox1.value"
SELECT * ;
FROM ("U:\Data\modacad.dbf") ;
WHERE &lcwhere ;
order BY mainkey ;
INTO CURSOR crssearch
Caroline


>Sorry
>
>the point I am making is that you are using the combo displayvalue twice.
>
>He should be entering
>
>lcwhere="modacad.key3=thisform.textbox1.value"
>
>so you could say
>
>lccondition = thisform.combo1.displayvalue
>
>lcwhere="modacad.key3"+lccondition+thisform.textbox1.value
>
>or
>
>lcwhere="modacad.key3"+thisform.combo1.displayvalue+thisform.textbox1.value
>
>then you don't need a case statment anyway.
>
>Nick
>
>
>
>>Does the following work?
>>Case ThisForm.Combo1.DisplayValue == "="
>>
>>When you look at this in the debugger what exactly is the DisplayValue?
>>
>>
>>>IF thisform.combo1.displayvalue='='
>>>then
>>>lcwhere="modacad.key3=thisform.combo1.displayvalue"
>>>
>>>will end up as "modcad.key3=="
>>>
>>>>I think you need the &lcWhere and your Case looks a bit odd to me. Try
>>>>
>>>>LOCAL lcwhere1
>>>>SET EXCLUSIVE OFF
>>>>SET DELETED ON
>>>>
>>>>DO CASE
>>>>	CASE thisform.combo1.displayvalue='='
>>>>           lcwhere="modacad.key3=thisform.combo1.displayvalue"
>>>>	CASE thisform.combo1.displayvalue='=='
>>>>           lcwhere="modacad.key3==thisform.combo1.displayvalue"
>>>>	CASE thisform.combo1.displayvalue='$'
>>>>           lcwhere="modacad.key3$thisform.combo1.displayvalue"
>>>>ENDCASE
>>>>SELECT * ;
>>>>FROM ("U:\Data\modacad.dbf") ;
>>>>WHERE &lcwhere ;
>>>>order BY mainkey ;
>>>>INTO CURSOR crssearch
>>>>
>>>>
>>>>
>>>>>Thanks Caroline,
>>>>>
>>>>>I decided to use variables in a case statements:
>>>>>
>>>>>
>>>>>LOCAL lcwhere1, lcwhere2, lcwhere3
>>>>>SET EXCLUSIVE OFF
>>>>>SET DELETED ON
>>>>>
>>>>>lcwhere1="modacad.key3=thisform.combo1.displayvalue"
>>>>>lcwhere2="modacad.key3==thisform.combo1.displayvalue"
>>>>>lcwhere3="modacad.key3$thisform.combo1.displayvalue"
>>>>>
>>>>>DO CASE
>>>>>	CASE 1
>>>>>		IF thisform.combo1.displayvalue='='
>>>>>			SELECT * ;
>>>>>			FROM ("U:\Data\modacad.dbf") ;
>>>>>			WHERE lcwhere1 ;
>>>>>			order BY mainkey ;
>>>>>			INTO CURSOR crssearch
>>>>>		ENDIF
>>>>>	CASE 2
>>>>>		IF thisform.combo1.displayvalue='=='
>>>>>			SELECT * ;
>>>>>			FROM ("U:\Data\modacad.dbf") ;
>>>>>			WHERE lcwhere2 ;
>>>>>			order BY mainkey ;
>>>>>			INTO CURSOR crssearch
>>>>>		ENDIF
>>>>>	CASE 3
>>>>>		IF thisform.combo1.displayvalue='$'
>>>>>			SELECT * ;
>>>>>			FROM ("U:\Data\modacad.dbf") ;
>>>>>			WHERE lcwhere3 ;
>>>>>			order BY mainkey ;
>>>>>			INTO CURSOR crssearch
>>>>>		ENDIF
>>>>>
>>>>>ENDCASE
>>>>>
>>>>>
>>>>>I get a syntax error. Do you have any ideas as to why this doesn't work?
>>>>>
>>>>>Thanks Caroline
Caroline
Previous
Reply
Map
View

Click here to load this message in the networking platform