>>>>>>We're finally getting somewhere! You did not use any PUBLIC variables.
>>>>>
>>>>>And the cycle resets...
>>>>>
>>>>>Do you guys remember "Lost"? Remember there was this sequence of numbers that needed to be punched before some counter elapsed? Discussions about PUBLIC variables seem to also have some frequency, I wonder what would happen if one day we forget to start the thread to discuss about them? Maybe that will signal the end of FoxPro, or the world!
>>>>
>>>>The point is to teach best practices.
>>>
>>>Well, I think you know that I not only agree with you about the use of public variables, I think you also know I go one or two steps further: no PRIVATE variables and no PUBLIC properties either, any changes in the state of an object should be accomplished by sending a message to it, never by assigning a value to a property (which should be protected anyways, or even hidden).
>>>
>>>Anyways, and to the risk of being called unprofessional by Al, I would say that, to my taste (which is, like any other's imperfect), you were not following best practices either in that small piece of code, as it was a function (or method) that was performing two distinctive tasks; so maybe a better solution would have been to separate the searching of the files (which can then be used for other purposes) with the actual testing of the files (and this should be done in two methods, one that checks an individual table and then one that checks a collection of tables, the output of the method that finds the files in the first place)
>>
>>During my period on Aruba, I was taught that I had to use private variables if I wanted to use them in a SQL pass through command. Was that lesson wrong?
>
>I think that's wrong, except that what you may have had was a single routine to make the SPT calls, with a need to make variables used in queries you build outside that routine public. In one of the apps I inherited, that's the basic approach, something like:
>
>
>PRIVATE cCustName
>LOCAL cSQL
>
>cCustName = ThisForm.txtCustomer.Value
>TEXT TO m.cSQL TEXTMERGE NOSHOW
>SELECT *
> FROM Customers
> WHERE cCustName = ?m.cCustName
>ENDTEXT
>
>DoQuery(m.cSQL, "csrCurrentCust")
>
>
>If you're doing the SPT in the same routine where you build the query, local works.
>
>Tamar
You're right, it was more or less the same construct. This was a class, where one method created the sql statement, and a second method called sqlexec. In the first method the variables had to be private, since they were used in the second one.