When getting an error "File is in use by another" - Is there a way to
trap what file is this I am using the sys(2018) but I don't get any
info in there.
Sure, I know when this happens. I am just wondering when I get this error - is there a way for me to figure out what is the file that I am trying to USE which gives out the error. Keep in mind that this is at the customer site where the installation is runtime and no VFP development.
here is my code for pos program when do close sales day.
latables is an array i declare at main.prg...
&& check any files locked FOR i = 1 TO ALEN(laTables,1) mFileUsed = .F. ON ERROR mFileUsed = .T. USE &mDatapath\&laTables(i,1) EXCLUSIVE ON ERROR IF mFileUsed MESSAGEBOX("Please check whether others computers has been shut down, and retry again. If confirmed others computers has been shut down, please restart this computer!") RETURN ENDIF USE NEXT
Obviously when I try to use a file. But I am not sure what file is the
one causing the problem cause Sys(2018) won't supply that in the error
trapping routine.
When getting an error "File is in use by another" - Is there a way to trap what file is this I am using the sys(2018) but I don't get any info in there.
No.This function only checks for the existense of the file on disk, not if somebody is using it. You probably where thinking of IF USED() but that only works within the same program instance.
If a file is in use EXCLUSIVE you'd get the 'file in use' error. First of all you have to make sure that your program opens all files in SHARED form (or have SET EXCLUSIVE OFF).
If somebody else opened it with another program, then you'd also get the error.
Could also be that the file is marked as read/only or the user does not have sufficient access or permissions to write to it.
Question : in a application who opens all files in shared form , how can i manage a "clean up" of my tables , i mean i want to be able to use "pack" some how. How i can do that I get the error : "File access denied ...".
What is the meaning of the following command : "flock"
File is in use by another.
usbeck
Sure, I know when this happens. I am just wondering when I get this error - is there a way for me to figure out what is the file that I am trying to USE which gives out the error.
Keep in mind that this is at the customer site where the installation is runtime and no VFP development.
Thx again.
Helen999888
here is my code for pos program when do close sales day.
latables is an array i declare at main.prg...
&& check any files locked
FOR i = 1 TO ALEN(laTables,1)
mFileUsed = .F.
ON ERROR mFileUsed = .T.
USE &mDatapath\&laTables(i,1) EXCLUSIVE
ON ERROR
IF mFileUsed
MESSAGEBOX("Please check whether others computers has been shut down, and retry again. If confirmed others computers has been shut down, please restart this computer!")
RETURN
ENDIF
USE
NEXT
then u can do anyting u like man .... hehe
Ccm1st
u can use the following command
if file("filename.dbf")
Steve Whitley
thx.
William Bartholomew
In what context are you seeing this error
ParamSE
>u can use the following command
>if file("filename.dbf")
No.This function only checks for the existense of the file on disk, not if somebody is using it. You probably where thinking of IF USED() but that only works within the same program instance.
If a file is in use EXCLUSIVE you'd get the 'file in use' error. First of all you have to make sure that your program opens all files in SHARED form (or have SET EXCLUSIVE OFF).
If somebody else opened it with another program, then you'd also get the error.
Could also be that the file is marked as read/only or the user does not have sufficient access or permissions to write to it.
David Chalmers
Question : in a application who opens all files in shared form , how can i manage a "clean up" of my tables , i mean i want to be able to use "pack" some how. How i can do that I get the error : "File access denied ...".
What is the meaning of the following command : "flock"
Thanks
Rory (Clissold Solutions)
Thanks, i know this solution . I must do this in a special procedure , it's the only way i guess.
I can't do it at the begining or end of the application