Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Macro changes variable type
Message
From
07/02/2002 11:36:42
 
 
To
07/02/2002 11:24:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00616675
Message ID:
00616683
Views:
14
Stéphane,

See if declaring i as a LOCAL variable helps.

>Hi,
>
>Here's a piece of code I'm running:
<b>LOCAL i</b>
>FOR i = THISFORMSET.nStart TO THISFORMSET.nEnd
>	FOR lnPosCommands = 1 TO ALEN(THISFORMSET.acCommands)
>		lcCommand = THISFORMSET.acCommands(lnPosCommands)
>		&lcCommand
>	ENDFOR
>	=MESSAGEBOX(VARTYPE(i)) &&<= displays 'C'
>	*i = Val(i)
>ENDFOR
>'acCommands' is an array property of the current FormSet.
>
>Each one of it's entries is a line of text which represents a call to another function using 'i'. Here's an example of one of those calls:
>
>save_FridgLabel(ALLTRIM(STR(i)), 20, 10)
>
>As you can see, the commands were built to use the 'i' variable of my FOR loop. My problem is that after the macro executes, 'i' is no longer of Numeric type but is now a Character (as displayed by the messagebox). Why?
>
>Nowhere in my macro am I setting 'i' (no i = ... and i is not passed as a parameter).
>
>How can I avoid this transformation?
>
>Thanks in advance, Stephane.
Daniel
Previous
Reply
Map
View

Click here to load this message in the networking platform