General information
Category:
The Mere Mortals Framework
>>I've got a real humdinger, whatever that means! On just a plain vanilla cBizobj form, I have a plain vanilla cPageframe. On page1 I have a single bizobj. The bizobj simply opens some free cursors. The init method of the form runs a query and creates a cursor. A command button runs another query based on a pick list, activates page2, and poplulates my grid. Runs like a charm. I have to reset my grid's rowsource property each time I run the query, but this has never been a problem.
>>
>>Here's the problem. (Hold on to your seats!) I have a combobox that sets a filter on the cursor. When I try this from the command window it runs fine. Example:
>>
>>SET FILTER TO HC_CODE='0P'
>>_SCREEN.ACTIVEFORM.REFRESH()
>>
>>If I put this code in the valid event of my combobox. I get all kinds of errors. Mostly Operator/Operand mismatch. The error tells that it is in the refresh method of the grid, but the debug window tells me the line of Code in the valid event of my combobox is the culprit.
>>
>>Here's the code:
>>LOCAL loSelect
>>
>>loSelect = CREATEOBJ('cSelect', 'cFinal')
>>SET FILTER TO
>>SET FILTER TO ALLTRIM(hc_code) = THIS.VALUE
>>
>>thisform.refresh()
>>
>>I have verified that THIS.VALUE contains a valid character value, which matches the value in the cursor. There is no reason why this would work in the command window and not in the form. Especially when I have doene this while the form is running. Any suggestions?
>
>This.Value may go out of scope as soon as VFP leaves Valid event. You may change you code to use literal value:
>cFilterstring="ALLTRIM(hc_code) = '"+THIS.VALUE+"'" && assuming that this is character
>Select MyCursor
>SET FILTER TO &cFilterstring.
Thanks Edward,
Your suggestion worked. I'm curious though. I thought set commands were global. Once you set them, that was it. Why would this behavior happen?
Curious in the Bronx.
Previous
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