Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why 'Thisform can only be used in method' error?
Message
De
30/06/2003 07:52:23
 
 
À
30/06/2003 07:10:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00805151
Message ID:
00805227
Vues:
24
Andy and David,

Thanks. I undertand the error when I use This or ThisForm in a procedure/function, etc. But within the RowSource of a combo of a form, well that sure feels like I'm 'within' the form to me.
Oh well, another of those nuances of VFP that I wasn't aware of. I'm sure there are many more.

My workaround was along the lines that David suggested but I'm sure that a Private var would have worked too.

cheers

>Hi Jim
>
>>Doing so results in the error message "Thisform can only be used in method" and the question is WHY?
>>
>>I've found a way around but don't see why I had to lose an hour on something that looks like it shouldn't happen.
>
>As David has already said, the actual execution of the SQL statement is not in the method code of the form.
>
>You will get the same erro (for the same reason) with parameterized views that reference a form property for the parameter, and if you call a function, procedure or pop-up menu that refers to "thisform".
>
>The solution is to transfer values from properties into variables in these situations, but then you must ensure that the variables are in scope when the query is compiled and executed. That means that such variables must be at least "Private" (so that they are available to the dependent function). Using Local variables in this particular scenario won't do.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform