Philip,
Use CREATE CURSOR and you can forget about generating unique names, Cursors are guaranteed to have unique file names even though the alias can be the same. This means that the temporary file for minth closing data can be;
CREATE CURSOR MonthClosing ...
without regard to how many stations may create that same cursor. The name given to a cursor is its ALIAS, the actual file name is guaranteed to be unique.
The other wonderfull sideeffect of using cursors is that you will never forget to clean them up, they are automatically cleaned up whenever you close them.
Also, whenever I use a table I always use;
USE MyTable ALIAS MyAlias SHARED AGAIN
just to prevent the error you are getting.
JimB
>Hi
>Trying to create two temporary tables with this bit if code.
>
> _ap1name = Sys(3) + '.TMP'
> _ap2name = Sys(3) + '.TMP'
>
> Create Table (_ap1name) (dbfname C(15))
> Index On dbfname Tag dbfname
> Use
>
> Create Table (_ap2name) (dbfname C(15))
> Index On dbfname Tag dbfname
> Append From Array a_files
> Release a_files
> Use
>
> Select 0
> Use (_ap2name) Alias _ap2 Order dbfname Excl
>
> Select 0
> Use (_ap1name) Alias _ap1 Order dbfname Excl
>
>Problem is that when it gets to the last line I get an error message saying that the table is already in use. It seems to be confusing the two tables.
>
>Any help greatly apprectiated.
>
>Phil