Re: USED()



Olaf
I thought so but ran into a problem checking it and apon looking into the
help, this is what I found.
Parameters
nWorkArea | cTableAlias
Specifies a table's work area or alias. USED( ) returns a logical true
(.T.) if a table is opened in the work area you specify with nWorkArea;
otherwise a logical false (.F.) is returned. USED( ) returns a logical true
(.T.) if an alias is in use with the alias you specify with cTableAlias;
otherwise false (.F.) is returned.
If you omit nWorkArea and cTableAlias, USED( ) returns a logical true
(.T.) if a table is open in the currently selected work; otherwise false
(.F.) is returned.

Remarks
USED( ) can determine if an alias is in use or if a table is open in a
specific work area.

I was useing the following and and got an error saying that file was already
open at times. I ended up using

use in lastid to close the file after I could not repeatly calculate if the
file was open or not as I did not know in which area it was being used.

IF USED('lastid.dbf')
SELECT LASTID
ELSE
SELECT 0
USE LASTID
ENDIF

What am I doing wrong in the above that I could not detect that the file was
open at times??



Tony

"Olaf Doschke" <olaf.doschke@xxxxxxxxxxxxxxxx> wrote in message
news:A339EAAC-5ABE-4B1C-A1C2-8527EB50CEDB@xxxxxxxxxxxxxxxx
Hi Tony,

USED( ) can determine if an alias is in use or if a table is open in a
specific work area.
wrong

USED(nWorkarea) determines if a workarea is in use,
but you will mostly use it as USED(cAlias), which checks,
if a certain alias is in use in _any_ workarea of the current
datasession. So there you have your answer.

Bye, Olaf.


.



Relevant Pages

  • Re: Closing a table
    ... You may have the table open in another work area under a different alias, ... in a different datasession if you use forms with private datasessions. ... You must specify the alias to close a table, but you may need to use a path ...
    (microsoft.public.fox.programmer.exchange)
  • Re: Removing aliases removes primary IP
    ... Note that lower case hexadecimal IPv6 addresses are acceptable. ... | 2) you remove an alias which the 'delete' argument. ... | specify which alias to be removed, the lowest IP number is removed. ... -Remove the network address specified. ...
    (freebsd-questions)
  • Re: Something else related to work item.
    ... Please do not send e-mail directly to this alias. ... KMDF framework, or the context info is only used by driver writers' own ... Meanwhile, for WDM work item object, we can specify whether we want to use ... callback has been called and completed. ...
    (microsoft.public.development.device.drivers)
  • Re: Something else related to work item.
    ... Please do not send e-mail directly to this alias. ... KMDF framework, or the context info is only used by driver writers' own ... Meanwhile, for WDM work item object, we can specify whether we want to use ... callback has been called and completed. ...
    (microsoft.public.development.device.drivers)
  • Re: Foxpro 9
    ... according to one of my old references, the alias could be SELECTed, but only if the ALIAS clause was used in the USE command. ... >> To find out what was actually going to be in work area 3, I had to sort>> through several pages of spaghetti code. ... >> - Rush ...
    (microsoft.public.fox.programmer.exchange)