Looking at the LOCATE, what cepMunicipio? I'm not sure where that comes from.
Also, the APPEND BLANK isn't right. If the record is NOT found in Municipios, it puts a value from Municipios into nao_encontrada. But, Municipios will be at EOF(), so a blank value will be put into nao_encontrada.
>Hi
>
>I want to use SCAN command ON table and select other tables and using LOCATE command inside SCAN struct.
>
>I remember having used this kind of structure before, but now it does not scan beyond first record of PED1.dbf
>
>Does LOCATE command interfer on SCAN ?
>
>Please see my code below:
>
>
>
>
> select ped1
> SCAN
>
>
> STORE ALLTRIM (PED1.CIDADE) TO codMunicipio
> STORE remSpecChars(codMunicipio) TO codMunicipio
> select municipios
> LOCATE FOR municipios.cep1_n <= cepMunicipio
>
> DO case
> case NOT FOUND()
> SELECT nao_encontrado
> APPEND BLANK
>
> replace nao_encontrado.retorno with municipios.c
>
> OTHERWISE
>
>
> SELECT nao_encontrado
> APPEND BLANK
> replace nao_encontrado.retorno with STR(cepMunicipio)
>
> endcase
>
>
> ENDSCAN
>
>
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer