Using a table with a program in multi uses environment

I need to record my applications errors in a free table file.
When i start the main program I start my on error() routine, within it I use a table in order to record my applications errors.
The first user runs fine when the second starts using the application he gets an error " file is in use".
is there something i could do?
luciliacoelhoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
When you record an error on a network you need to have the file shared in access mode. So maybe you are opening the file before SET EXCLUSIVE OFF. What you need to do is this: USE ERROR SHARED.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Olaf DoschkeSoftware DeveloperCommented:
Cyril most likely is right. Also consider even if you do SET EXCLUSIVE OFF, this setting needs to be redone for every new datasession, it's NOT a general setting.

There's a slight chance for something else: Even if you use your error dbf shared, an error "file is in use by another user" can occur, so the question is, do you have error 3 or 108? Report the error number additional to the error message to see what exact error you have. The difference is, you'll also get this with shared use, if a write locks the header for a moment. If you do transactions that could even last longer than you want, if you forget to end it. Close the dbf after writing the error in it, close/rollback all tranactions even before opening it. Also the initial error leading to the error handling could be during a transaction.

Bye, Olaf.
0
pcelbaCommented:
I also recommend to open/close error file when an error occurs, I just don't agree with SET EXCLUSIVE OFF necessity.

SET EXCLUSIVE OFF is default for private data sessions but the best practice is to place the EXCLUSIVE/SHARED keyword into each USE command as Captain recommended.

Your error points to the locked file header. If you SET TABLEVALIDATE TO 0 before opening then the error should disappear BUT it does not ensure the new error writability because of the pending lock.

If the error occurs during a transaction then you should just ensure the error.DBF is a free table which also means "outside" the transaction obviously.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FoxPro

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.