ID: Q120536
2.5x 2.6x 3.00 | 2.00 2.5x 2.6x
WINDOWS | MS-DOS
The information in this article applies to:
You receive the error message "Not a numeric expression" after any of four types of @ ... GETs: buttons, radio buttons, popups, and list boxes.
The FoxPro for Windows "Developer's Guide" for versions 2.5x and 2.6x states on page B-26 that the error "Not a numeric expression" occurs when "An attempt was made to use the SUM command on a non-numeric field."
Another cause for this error message is using a variable that has not been initialized after being declared in a button, radio button, popup, or list box.
If a variable is declared, but not initialized, it contains the value of false (.F.). If you then use this variable as the variable for specific types of @ ... GET commands, you will see the "Not a numeric expression" error when you run the code.
The solution is to initialize the variable to a number, or to not declare the variable at all.
1. Place the following code in a program called TEST.PRG:
CLEAR
RELEASE ALL
PUBLIC var1, var2, var3, var4
DIMENSION myarray(4,1)
myarray(1,1)="LIST1"
myarray(2,1)="LIST2"
myarray(3,1)="LIST3"
myarray(4,1)="LIST4"
DEFINE WINDOW main AT 0,0;
SIZE 17.875,70.286 ;
FONT "MS Sans Serif", 8 ;
FLOAT ;
NOCLOSE ;
MINIMIZE ;
SYSTEM
ACTIVATE WINDOW main
@ 4.500,3.429 GET var1 ;
PICTURE "@*HN BUTTON1; BUTTON2" ;
SIZE 1.625,11.875,0.500 ;
DEFAULT 1
@ 6.688,3.429 GET var2 ;
PICTURE "@*RVN RADIO1; RADIO2" ;
SIZE 1.063,7.750,0.250 ;
DEFAULT 1
@ 1.375,42.857 GET var3 ;
PICTURE "@^ POPUP1; POPUP2" ;
SIZE 1.500,15.125 ;
DEFAULT 1
@ 4.438,44.714 GET var4 ;
PICTURE "@&N" ;
FROM myarray ;
SIZE 4.500,17.000 ;
DEFAULT 1
READ CYCLE
RELEASE WINDOW main
2. Run the program. The "Not a Numeric Expression" error will occur.
3. Choose the Ignore button. The error will occur again for each @ ... GET
defined in the program. If you keep choosing Ignore, the program will
run through to the end.
There are two ways to resolve this problem:
-or-
"Language Reference," version 2.5 (MS-DOS, Windows), pages L3-31 to L3-126
Additional reference words: FoxDos FoxWin VFoxWin 2.00 2.50 2.50a 2.50b 2.60 2.60a 3.00 listbox errmsg KBCategory: KBSubcategory: FxprgGeneral
Keywords : kberrmsg FxprgGeneral
Version : 2.5x 2.6x 3.00 | 2.00 2.5x 2.6x
Platform : MS-DOS WINDOWS
Last Reviewed: May 22, 1998