>What a community! I post a message at 03:06pm and you reply by 03:18pm! Just got back in town today and appreciate your response. I guess this leads to another question since LOCAL variables are the safest way to go. Do most developers define all the variables at the beginning of a routine, or declare them local as they are defined? Also, is there a way to tell VFP to REQUIRE variable declarations? I tend to define variables and names as I go through the programming process and don't know if I'll always remember to add the local declarations each time I create a new variable. But if VFP could generate an error upon using an undeclared variable I'd catch that (hopefully) the first or second time I ran the routine.
>
>Thanks again for your response.
>
Dean,
I tend to declare variables at the beginning. Most often, the process is:
First, I declare the variables I know I'm going to need.
Second, as I work further, if there are variables I didn't anticipate, I go back and add them to the declaration.
Third, and I think most importantly, I initialize the variables as close to when they're first referenced as possible. This prevents another programmer later coming in and using the same variable for another purpose. IOW, if I don't use the variable until the end of the code, that's where I initialize it. If, at a later date, someone else modifies the code and uses that variable earlier, no unknown results will occur.
hth,
George
Ubi caritas et amor, deus ibi est