>select * from mytable into cursor tmp where.......
>but mytable.dbf still open after tmp cursor formed
>is there any way to close mytable automatically after selected ?
I wouldn't worry about doing that in the first place, for several reasons.
* If you keep the tables open, it's faster to run the query again next time. Some forms/processes may need to run a query more than once. Or other queries, based on the same tables.
* Both tables and cursors are closed automatically, once the form that opened them is closes. This assumes, of course, that you use a private datasession, AS YOU SHOULD, most of the time at least.
* Similarly, tables and queries opened in one form don't interfere with tables and queries with the same name, opened in other forms. Once again, this assumes you use a private datasession.
* So, the open tables don't cause any real harm.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)