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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement