Are you using a grid in this scenario? If so, there's a quirk with grids where they re-select their RecordSource if you try to select another table, as long as the grid has focus. I've run into this situation where I've displayed a grid, and had a button that ran some other code. If I clicked on the button (and therefore moved focus to the button), it worked, but if I used the hot key to fire the button it didn't work.
>I have a procedure which displays records from a table depending if they match certain requirements set by the user (such date from, date to etc). When a record matches the requirements it is copied to a temporary table. This works most of the time, but, on some occasions VFP is finding itself on the wrong table and when I suspend and do a "? alias()" the name of the temporary table is printed, yet I haven't selected the temp table.
> The source below is one example:
>
>select fixtures
>go top
>do while .not. eof()
> mpos = recno()
>
>* determines whether the record should be copied to the temp table
>
> select fixtures
> go top
> go mpos
> skip
>enddo eof()
>
>An error occured on the "go mpos" saying "record out of range". I suspended and done a "? alias()" and the temp table is selected. AHHHH!, How?
>
>Many thanks to anyone who tries to help in advance.