>>>I know - that old chestnut
>>>
>>>I've made some changes to a form and since, whenever I click on a particular combo, the first time, I get:
>>>
>>>"THISFORM can only be used within a method".
>>>
>>>I've tried to trace where in debug, even to putting some dummy code in the combo's .GotFocus(), but it follows the code then the message appears from nowhere. Now, I have no code outside the form's methods, referenced anywhere in the form, that includes "Thisform", nor is that the among any of the changes I made. The 2nd time I click on the combo it behaves properly.
>>>
>>>The only code I have in the combo is in the .InteractiveChange() and this isn't reached (in debug) before the error message.
>>>
>>>I was using some "thisform.cRouteNo" in a filter string , and in an SQL statement, which I vaguely remember VFP7 doesn't like, so first loaded a method var with this and substitued this in the strings, but made no difference (and indeed these snippets aren't reached first anyway.
>>>
>>>This has got me baffled. Any ideas
>>>
>>>'ppreciate it
>>>
>>>Terry
>>
>>Terry,
>>Can you post the code where you set filter?
>
>Boris, Guys
>
>I've narrowed it down to this in the form's .Init(). Originally I had:
>
>... "END_DATE >= .dEndDate ... in the lcFilter equation. I've since set ldDate to .dDate
>but now I'm getting "operator/operand type mismatch" on the Set Filter command. I haven't sussed the correct formatting yet (it was happy before) but at least I know WHERE the bloody problem lies. I'm posting this now just so's you're not hanging on.
>
>Thanks a lot for your attention.
>
>Terry:
>
>
>With Thisform
> .nOperator = NOTETM.OPERATOR
> .cRoute = NOTETM.ROUTE
> .dStartDate = NOTETM.START_DATE
> .dEndDate = NOTETM.END_DATE
> .pgfMainPageFrame.Page2.Refresh()
> .lContracts = .F.
>* For Now> lcFilter = "OPERATOR = " + ALLTRIM( STR( .nOperator)) + " and " + ;
>* For Now> "END_DATE >= CTOD('" + DTOC( .dStartDate) + "')" + ;
>* For Now> " or EMPTY( END_DATE)"
> lnOperator = .nOperator
> ldDate = .dStartDate
> lcFilter = "OPERATOR = " + ALLTRIM( STR( lnOperator)) + " and " + ;
> "END_DATE >= ('" + DTOC( ldDate) + "') or EMPTY( END_DATE)"
> Select RTEFAM
> Set Filter To &lcFilter
> ...
>
It should be:
"END_DATE >={" + DTOC( ldDate) + "} or ...
Edward Pikman
Independent Consultant