Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Public variable changes during tableupdate()
Message
 
To
22/02/2005 13:33:17
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00989337
Message ID:
00989359
Views:
16
>I have an old program now being rewritten in visual. It uses a public variable 'gnitemnumb'. When a TABLEUPDATE() is issued the variable value is changing. When we set DEBUG on and trace the code it does not change. The code is as follows:
>
>
>gnitemnumb = 1                         && variable is set
>TABLEUPDATE(.t.)
>wait window STR(gnitemnumb)            && displays a 0
>
>
>The name 'gnitemnumb' is not associated with the table in any way (i.e. field name, index name) and if we change the variable name to 'gnitemnumb1' it all works fine.
>
>Any ideas as to why this may be happening?
>
>Thanks,
>Hetty

Hetty;

I am sorry to not offer a solution to your problem but one of the things I have practiced from the beginning of using VFP is to not use global variables! With a global you can have a difficult time finding out where a change occurs.

Sometimes I have seen developers create a global and change data types on the fly. Such a problem was discovered when an “End of Month” report was run. Gee, all was well for a month! And then…

Somewhere in the dark recesses of your program something is changing the value of your global variable. Change the variable name or go an extra step and get rid of all global variables!

(Easy for me to say!) :)

Tom
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform