Mike Jacobs
asked on
Bizarre VFP Code Contradiction
created a simple check for the existence of a field in a remote table. It failed, despite the existence of the relevant field. To troubleshoot why, I created the following very simple code which should enable you to recreate the issue. Bear in mind that you must NOT be in the remote table. (the whole point was to avoid leaving the table I was in and disturbing the existing pointers)
Create a table called phones, with a field called PHPRIME
create or use any other table and make it current
Use PHONES IN 0
This is the code which demonstrates the problem:
FNAME=FIELD('PHPRIME','PHO NES') && that syntax clearly suggests we SHOULD be able to run the test more directly as in IF NOT FIELD('PHPRIME','PHONES')= ='PHRIME'
*but it fails so I tried:
IF FNAME=='PHPRIME' && which it does
IF NOT FIELD('PHPRIME','PHONES')= ='PHRIME' AND FNAME=='PHPRIME'
WAIT WINDOW 'BRAIN EXPLODES HERE'
ELSE
RETURN
ENDIF
ELSE
RETURN
ENDIF
So, what hidden VFP secret am I missing here?
Create a table called phones, with a field called PHPRIME
create or use any other table and make it current
Use PHONES IN 0
This is the code which demonstrates the problem:
FNAME=FIELD('PHPRIME','PHO
*but it fails so I tried:
IF FNAME=='PHPRIME' && which it does
IF NOT FIELD('PHPRIME','PHONES')=
WAIT WINDOW 'BRAIN EXPLODES HERE'
ELSE
RETURN
ENDIF
ELSE
RETURN
ENDIF
So, what hidden VFP secret am I missing here?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Have you any idea how many times I looked at that without spotting the typo - which I assumed MUST be there (and I repeated and fixed in my other tests)
I'm off to get a brain transplant.
Thanks