>ndxname = 'X' + SYS(3)
>INDEX ON [fldname] TO &ndxname
>
>Look familiar? This is how we FP'ers have created a new filename since the beginning of time. And I am having a 'File in use by another' error come up on my client's app, sometimes. Actually not sometimes, but always on my client's PC's which run Win98, the error does not happen on the one PC in the store that runs Win95. However, it does not occur on my development PC, which runs Win98 too. It does NOT make sense to me that this is the operative difference but I have nothing else to go on. Any ideas?
SYS(3) isn't guarenteed to create a unique name; SYS(2015) will, though (but it won't be DOS file name compatible necessarily). I'd also change you code to:
INDEX on &fldname TO (ndxname)
assuming that
fldname contains the name of the field (or the index expression; it can contain a complex expression using macroexpansion) to use to create the index, and
ndxname contains the name of the index file to create as you've indicated, using name substitution rather than relying on macroexpansion for the name of the file.