Hi Steve
That should work, except I'd use one replace command instead of two.
replace specialty with refDocsAddy.specialty,;
location with refDocsAddy.city in refDocsWithAddress
>Ravi,
>
>I see what you want now. APPEND FROM won't help you here (it could be called several times inside of a loop, but it would be very inefficient).
>
>Is this something you will have to do regularly? If so, consider not doing it at all. You can pull this information together at any time with one SQL Select statement, joining on the common field.
>
>Also, I don't know if having a field called 'number' is a good idea because it is a VFP reserved word.
>
>Here is one way. Change lcTagName line to the correct index tag for the refDocsAddy table (it is used in the indexSeek call). This is off the top of my head, so test it on backup data.
>
>
>local lcTagName
>lcTagName = "refsDocsAddyTag"
>use refDocsAddy in 0
>use refDocsWithAddress in 0
>select refDocsWithAddress
>scan
> if indexSeek(refDocsWithAddress.number, .t., 'refDocsAddy', lcTagName)
> replace specialty with refDocsAddy.specialty in refDocsWithAddress
> replace city with refDocsAddy.city in refDocsWithAddress
> endif
>endscan
>
>HTH,
>
>steve
>
>
>>>What do you mean by "for the first record only"? Are you expecting it to append several records? A not eof() loop won't help...because that function won't evaluate properly for the table you are appending from (at least I don't think it will).
>>>
>>Steve:
>>
>>I have two tables RefDocsAddy and RefDocsWithAddress.
>>
>>RefDocsAddy has the following fields: Number, Name, Speciality, City
>>RefDoscWithAddress has the more fields in addtion to the fields in RefDocsAddy
>>
>>What I am trying to accomplish is, if there is a matching value in the Number fields of both tables, then I want RefDocsAddy.Speciality and RefDocsAddy.City to be inserted into RefDocsWithAddress.Speciality and RefDocsWithAddress.Location. Then move to the next record and if there is a match, do the same.
>>
>>Hope I am making sense. Thanks.