Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Form - New Method - Memory Variable Behavior
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Form - New Method - Memory Variable Behavior
Miscellaneous
Thread ID:
00246580
Message ID:
00246580
Views:
63
I have a form to let users change the details of an order (for example to add or delete product quantity). I have txtBoxes for Product and Qty (the ControlSources are mProduct and mQty, respectively). In the Valid of each txtBox, I call a method I have created called CalcQty (ThisForm.CalcQty(.T.)). So, once the user has entered both the Product number and the Qty, the program is to then do a calculation and update some other txtBoxes that I also have on this same form -- txtBoxes for Original Qty and Adjusted Qty.

Here is the CalcQty Method:
LPARAMETERS plCalc

IF plCalc = .T.

	* IF Product or Qty hasn't been input, can't do calculations!
	IF mProduct = ""
		RETURN
	ENDIF

	IF mQty = 0
		RETURN
	ENDIF

	DO CASE
		* CASE Add Product
		CASE blah,blah,blah

		* CASE Delete Product
		CASE blah,blah,blah
	ENDCASE

	ThisForm.Refresh()

ENDIF
The problem is that IF mProduct = "" doesn't seem to be working. When mProduct equals = "" then you are indeed RETURNed. But when mProduct = something different, like "281600", you are also RETURNed. I have looked at it running the Debugger. For example, when the Debugger says that mProduct = "281600" the IF mProduct = "" statement seems to evaluate to True (even though it should evaluate to False), and you are RETURNed. So the calculations *NEVER* get done. So frustrating! The IF mQty statement seems to be evaluating without a problem.

Why the difference? Any help would be most appreciated. TIA, Chuck Henry.
Chuck Henry
Next
Reply
Map
View

Click here to load this message in the networking platform