>hi all,
>I have the code below. it used to work fine but it no longer does. i had not changed the code, at least i am 99% sure that i did not. i have now added in some wait windows to find out whats happening. it is taking a car registration number and making sure that it was not used already. If i try this in a vfp command window it works, in code on the form it does not. i have checked the values that i pass in and they are all correct, ie a duplicate should be found. any help much appreciated.
>
>lclregno = UPPER(ALLTRIM(thisform.pgfpageframe1.page4.txtCma_regno.Value))
>
>SELECT 0
>SELECT NWC
>
>WAIT WINDOW "reg is_" + lclregno + "_"
>
>IF lclregno <> ""
>
> WAIT WINDOW "regno variable is not blank"
>
> SELECT NWC
> SEEK lclregno ORDER CMA_regno
>
> IF EOF()
> WAIT WINDOW "try a locate first"
> SELECT NWC
> LOCATE FOR lclregno = UPPER(ALLTRIM(CMA_regno))
> IF FOUND()
> WAIT WINDOW "locate found it"
> ELSE
> WAIT WINDOW "not found"
> ENDIF
>...
>...
>
Mark,
In your form, where you test it, some conditions might be different. ie: These effect the result
set key to
set filter to
set deleted
set exact && might effect if not using a full key
Also note that:
LOCATE FOR m.lclregno = UPPER(ALLTRIM(CMA_regno))
is not the same thing as:
LOCATE FOR UPPER(ALLTRIM(CMA_regno)) = m.lcRegno
when exact is off.
PS: I suggest to use m. wherever possible to prevent other type of errors.
Cetin