Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
THISFORM can only be used within a method
Message
From
12/01/2007 12:33:03
 
 
To
12/01/2007 12:27:20
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01185055
Message ID:
01185135
Views:
15
>>>>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.	&& Posit
>>* 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 ...

Thanks Eddie, but that gives me the "ambiguous datetime constant .." message (wants it in yyy-mm-dd format). I prefer to keep to ("dd-mm-yy") format and avoid the braces. I probably would have had it fixed by now if not for answering messages :-)
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform