Used() needs workarea or alias. not sure if jobsweb is not opened again under another alias if already open.
Upd: had focused too much on mwebpath being empty or not - but as there is an extension, problems are to be expected if table is already open!
Fully concur with Al that you go overboard with macro expanding!
As your code DEPENDS on specifically named alias, I'd force it if wanting to keep most of the other code the same:
local lcAliasJobs, lcAliasAppl, lcDbfJobs, lcDbfAppl
lcAliasJobs = "jobsweb"
lcDbfJobs = mwebpath+ lcAliasJobs + ".dbf" && or forceext()
USE (lcDbfJobs) IN Select(lcAliasJobs) Alias (lcAliasJobs)
or
local lcAliasJobs, lcAliasAppl
lcAliasJobs = "jobsweb"
USE (mwebpath+ lcAliasJobs + ".dbf") IN Select(lcAliasJobs) Alias (lcAliasJobs)
Take the time to read some of the Hentzenwerke books intoducing vfp, (Internet, Kilofox, Megafox IMO best for "well balanced code" among them), esp. the code parts or visit Ricks site and read some of his sources to get better habits! You will make up for the time spent doing this.
>I have a weird, and persistent problem. A free table that doesn't want to close. Here is code:
>
>
>IF mwebenable
> thiswebfile=&mwebpath+'jobsweb.dbf'
> thiswebfile1=&mwebpath+'applweb.dbf'
> USE &thiswebfile1 IN 0
> SELECT applweb
> SET ORDER TO 1
> IF !USED('&thiswebfile')
> USE &thiswebfile IN 0
> ENDIF
> SELECT jobsweb
> SET ORDER TO 1
> SEEK mponum
> ....
> ....
> SELECT applweb
> USE IN applweb
> SELECT jobsweb
> USE IN jobsweb
>ENDIF
>
>
>NO problems with 'applweb.bdf' at all, but run the prg more than once, and 'jobsweb.dbf' comes up unclosed. And I have tried all combos of Select and Use that I can think of.
>
>I can't use 'close tables all', as that will close the stuff in the DE, too, which is NOT wanted.
>
>What else can I do? ANY ideas will be greatly appreciated!
>
>Thanks!