Link to home
Start Free TrialLog in
Avatar of Mike Jacobs
Mike JacobsFlag for United Kingdom of Great Britain and Northern Ireland

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','PHONES')  && 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?
ASKER CERTIFIED SOLUTION
Avatar of Pavel Celba
Pavel Celba
Flag of Czechia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike Jacobs

ASKER

aaaaaaaaaarrrrrggghhh

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