< snip >
>
>The same problem is with SQL SELECT statement.
>
>use mytable in 0
>select recno('mytable') from mytable
>
>produces constant recno() values.
>
>However, if mytable is not opened prior to select:
>
>use in mytable
>select recno('mytable') from mytable
>
>recno() works correctly !
>
>Does'nt this smell like another bug ?
No it's not a bug. You're again trying to use record oriented RECNO() function inside set oriented SQL SELECT statement. To do this succesfully, you have to know that SQL SELECT never uses already open tables. It performs the equivalent of USE ... AGAIN to open those table for internal use.
Here's excerpt from VFP 7 help:
"Be careful when using, in join conditions, functions such as DELETED( ), EOF( ), FOUND( ), RECCOUNT( ), and RECNO( ), which support an optional alias or work area. Including an alias or work area in these functions might yield unexpected results. SELECT doesn't use your work areas; it performs the equivalent of USE ... AGAIN. Single-table queries that use these functions without an optional alias or work area will return proper results. However, multiple-table queries that use these functions — even without an optional alias or work area — might return unexpected results. "
--sb--