>Hey Everyone,
>I am trying to perform a command like :
>If not Exists(select field from database where anotherfield = this)
>
>Does Foxpro have an exists command that would allow me do this? I keep getting a "Function Name is Missing" error. Am I doing this wrong? Should I be using another command to perform this? Any help would be appreciated. Thanks.
In VFP you cannot use EXISTS outside of SQL Select. You can emulate it using following code
CREATE CURSOR dummy ( dummy c(1))
INSERT INTO dummy VALUES("*")
SELECT dummy FROM dummy WHERE EXISTS ( ;
SELECT * FROM mytable WHERE field1 = somevalue) ;
TO SCREEN NOCONSOLE
IF _TALLY = 0
...
ENDIF
If subquery returns not many records than even simplier.
SELECT field1 FROM mytable WHERE field1 = somevalue ;
TO SCREEN NOCONSOLE
IF _TALLY = 0
...
ENDIF
--sb--