>I've defined some constants in my main program, put when I call another procedure and reference the constant I get the error "variable not found". My understanding is you define the constant once and it should be available thoroughout the program.
>
>I've checked syntax and even moved the code to the main procedure where it works fine, but still it does not work in the called procedure.
>
>What's up with that?
You misunderstood. A #DEFINE is in effect not for the entire application, but for the file that it is physically located in; IOW, if you have a procedure file, any #DEFINEs in the procedure file will be in effect for all procedures and functions in that procedure file. if a physically different file references that constant, you need to include that #DEFINE in that file.
It's worse for Visual classes; each method needs to have the #DEFINES it uses declared in it.
An easy method to address this is to create a .H file containing your #DEFINES and #INCLUDE that file whereever it's needed. In VFP6, a new system variable, _INCLUDE, was added to VFP; if you put the name of a file in this variable, it will be automatically included and available to everything.
Realize that #DEFINEs are a compile-time directive; you won't be able to reference the constants you defined at compile time directly during runtime. This often causes confusion in the debugger, where you might want to watch for a variable to take on the value of something that you've #DEFINEd as a constant - the constant may not be available to the debugger, which can confuse you easily.