Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Did anybody meet this bug?
Message
From
24/10/2002 03:00:23
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00714296
Message ID:
00714691
Views:
14
But I found other strange behavior:
Try next code.
In the method Find1() VFP display error 12: "Variable 'cField1' is not found". OK, it is a twice-told tale.
But in second method Find2() command SELECT raise error "Property cField1 is not found", and you can release object "o", create again, and recall only method Find2(), and newly the same error will occur in command SELECT!
Jiri
CLOSE ALL
CLEAR ALL
CREATE TABLE Tab1 (Field1 C(3))
INDEX ON Field1 TAG Field1
INSERT INTO Tab1 VALUES("ABC")
INSERT INTO Tab1 VALUES("123")
INSERT INTO Tab1 VALUES("XYZ")
USE 
o = CREATEOBJECT("cTest", "TAB1.DBF")
? o.Find1("ABC")
? o.Find2("ABC")
*----------------------------
DEFINE CLASS cTest AS Custom
	cField1 = SPACE(3)
	cDBF = ""
	PROCEDURE Init
		LPARAMETERS tcDBF
		THIS.cDBF = tcDBF
	ENDPROC 
	PROCEDURE Find1
		LPARAMETERS tcValue
		USE (THIS.cDBF) ALIAS aTab
		THIS.cField1 = tcValue		
		WITH THIS
			LOCATE FOR Field1 = .cField1
		ENDWITH
		USE
		RETURN FOUND()
	ENDPROC
	PROCEDURE Find2
		LPARAMETERS tcValue
		THIS.cField1 = tcValue		
		SELECT * FROM (THIS.cDBF) WHERE Field1 = THIS.cField1
		RETURN (_TALLY > 0)
	ENDPROC	
ENDDEFINE 
*----------------------------

>Jiri,
>
>WITH/ENDWITH doesn't work in LOCATE and it never has. I don't know if it is a bug or by deaign. You can fix it by;
>
>
>WITH This
>  ...
>  LOCATE FOR Field1 = This.cField1
>  ...
>ENDWITH
>
Previous
Reply
Map
View

Click here to load this message in the networking platform