>>>>>I am probably missing something very simple (I guess too many hours working today <g>). Here is the situation:
>>>>>
>>>>>
>>>>>* Cursor MyCursor is empty
>>>>>* Table MyTable has field PK. The first record of MyTable PK is 5
>>>>>* Other record in MyTable have different values of PK (1,2,etc).
>>>>>* The following command is supposed to append records...
>>>>>select MyCursor
>>>>>append from MyTable for MyTable.Pk = nPk
>>>>>* but the above works only if nPk is = 5 (that is, the value in the
>>>>>* first record of MyTable. If I try any other value of nPk, no
>>>>>* records are appended to MyCursor
>>>>>
>>>>>
>>>>>What am I missing?
>>>>>
>>>>>Thank you.
>>>>
>>>>The append from kind of reopens MyTable and selects it as the current alias for the time of the append.
>>>>The reopened alias is then closed and the previous workarea is reselected (MyCursor)
>>>>Hence, do not prefix Pk with any alias
>>>
>>>>
>>>>select MyCursor
>>>>append from MyTable for !deleted() and (Pk = m.nPk)
>>>>
>>>>
>>>>The code you are using can be translated as follows
>>>>
>>>>local AppendAnyRecord
>>>>AppendAnyRecord = (MyTable.Pk = nPk)
>>>>
>>>>select MyCursor
>>>>append from MyTable for m.AppendAnyRecord
>>>>
>>>
>>>Gregory,
>>>
>>>Following up your explanation that MyTable is reopened for the append (with a new alias, say XX) then APPEND FROM MyTable FOR MyTable.Pk = nPk is equivalent to: APPEND FROM xx FOR MyTable.pk = nPK.
>>>This is the equivalent, in turn, of asking to append ALL records from XX since MyTable is in a record with pk=nPk. (MyTable does not move from that record throughout the append). If MyTable were in a record for which pk # nPK, no records will be added.
>>
>>Correct. Do a little test to verify
>>
>>>The only problem with this is that I understand Dmitry found that only one record is appended in the original case, so this explanation is only correct if I misunderstood :)
>>
>>I do not find that assertion in Dmitry's text. But I may have skipped that :)
>
>Gregory,
>
>You understood me correctly. When I specified the PK equal to the first record in the MyTable, ALL records from MyTable were appended.
>So, I think Alejandro misunderstood :).
hi Dmitry,
Thanks for the clarification
I confess I had tested the story before posting it, so I was almost, almost sure - you never know when programming or computers are involved
Gregory