Terry,
With SET EXACT OFF lcCIFCCode = "" will always return true because VFP compares the left side to the lenght of the right side, which is 0. Because of that lcCIFCCode <> "" will aways return false. It's covered pretty well in VFP help for SET EXACT command. You can either change comparison to exact
If NOT (lcCIFCCode == lcPrevCIFCCode)
or assign inital value to lcPrevCIFCCode that never occurs in data
lcPrevCIFCCode = "??????"
>Dear Fox Maniacs
>
>I have the most puzzling bit of code that seems to me that it absolutely should work fine but "disobeys" me.
>It's reading a Low Level File (CIF format - English) of Bus Stops details, in order to import them into my DB.
>- Each LL rec, I get its County Code which I need to map to my system's equivalent, in the function/method "
.lmLookUpCCode()".
>- It's likely that many stops for the same county will be contiguous, so I don't call the look-up every
> time, only when the CIF county code differs from the previous (
lcPrevCIFCCode)
>- So the first time round the loop they will definitely be different, as I've
> initialised lcPrevCIFCCode to "" and I know I have a value in
lcCIFCCode.
> This is verified in debug
>- However, at the line:
>
>
If lcCIFCCode <> lcPrevCIFCCode && No point re-seeking C Code if same as prev>
>it just skips past the if test and goes straight on to:
>
>
If Not EMPTY( lcCountyCode)>
>- Couldn't believe my mince pies (eyes)!! How dare VFP disobey me!?
>- I know I have a && comment after the If statement but I usually do and it's legal.
>- I know there's a comment line after - * 23/12/04 - but that's perfectly legal, and there's no continuation line ";" at the end of it. Just to be on the safe side I've tried moving it about, leaving free lines around it, etc., but makes no difference.
>
>This is singularly bewildering. Any ideas?
>
>'ppreciate it
>
>Terry
>
>
<snip>
--sb--