Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
THISFORM can only be used within a method
Message
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:
01186036
Views:
28
Is it crashing when lcFilter is assigned (the code below) - or when lcFilter is "executed".

Combo Values (except for the index) - (I thought) were always character data types.

If it is happeneing when lcFilter is "pushed" (executed) - how does that satement look.

If it's a macro I remember something about double dots (..).

I left "filtered queries" a while back in favor of a few addional multi key TAGS in the CDX and "SET NEAR OFF/IN" to resolve the first record pointer. Followed by a SCAN or dowhile

Maybe it needs parens or an EVAL() to help. OR, perhaps a SET NEAR
INDEX ON OPERATOR+DTOC(END_DATE)
lcMyKey=myCombo.Value+DTOC(thisform.dStartDate)
SET NEAR ON
SEEK lcMyKey
SET NEAR OFF
Set Near will typically stop one after the closest match if it can't find an exact match. combinations of SET EXACT and SET NEAR with an indexed search are a lot faster than filtered searchers - you you immediately weather or not their is data to publish.

It only takes a few minutes to figure how SET NEAT/SET EXACT combinations behave. THey're much faster than afilter. - Just rember to restore them to you apps defaults when you've finished!

>Thanks for all the input on this one, guys. Sorry I haven't got back sooner but the UT's been out of order for me this PM. The filter code appears in a few places on the form and I've got round the problem sort of in this way:
>
>
>lcFilter	= "OPERATOR = " + ALLTRIM( this.Value) + " and " + ;
>	  "END_DATE >= CTOD('" + DTOC( thisform.dStartDate) + "') or EMPTY( END_DATE)"
>
>
>Trouble is now that VFP can't seem to make up it's mind what data type my combo value is. I'm getting batted from pillar to post in that: first it gives me a value, func, arg error on the " + ALLTRIM( STR( this.Value)) + ", cos the operator code, value from the combo is supposed to be numeric, but this.Value shows up in debug as, say, " 5" rather than 5.
>
>OK says I, and I change it to " + ALLTRIM( this.Value) + " as above.
>
>Then later I get another value, func, arg error cos the value is now 5!!!! I can't win!
>
>Similar is happening to the textbox, in which I copy the code extracted from the combo (the operator can be selected either by typing in its code in a text box or selecting from the combo. Eithe rmethod needs to update the other with the selected value.
>
>Now I've initialised their values appropriately with 0 in the props.
>
>I've come across this problem before but I can't recall the soln.
>
>Cheers
>
>Terry
>>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
Imagination is more important than knowledge
Previous
Reply
Map
View

Click here to load this message in the networking platform