Information générale
Catégorie:
Codage, syntaxe et commandes
First of all, used() requere ALIAS name, not the file name.
if !used('myfile')
sele 0
use myfile
endif
Another problem is that table could be open using alias name differ from the table file name. Then this may help:
?isused('myfile')
Procedure isused
Lparameter pcTableName
local retval
retval=.f.
pcTableName=alltr(upper(pcTableName))
release aa
if aused(aa)>0
Local iaa
for iaa=1 to alen(aa,1)
if "\"+pcTableName+".DBF"$ dbf(aa[iaa,1])
retval=.t.
endif
endfor
endif
release aa
return retval
>i have a function that i use in a number of forms. in it i need to determine if a certain file is open and if not, open it. code goes like this:
>if !used('myfile.dbf')
>sele 0
>use myfile
>endi
>the problem is that VFP goes into the IF even if the file is 'used' and gives an error message that says the file is already in use. any ideas on how to actually see if the file is open or not?
>tia!
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement