Using a table with a program in multi uses environment

Posted on 2011-10-17
Medium Priority
Last Modified: 2012-05-12
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?
Question by:luciliacoelho
LVL 27

Accepted Solution

CaptainCyril earned 1000 total points
ID: 36983780
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.
LVL 30

Expert Comment

by:Olaf Doschke
ID: 36984382
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.
LVL 43

Assisted Solution

pcelba earned 1000 total points
ID: 36986885
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.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
Applications for our next round of the Experts Exchange Scholarship Contest are starting to roll in. It made us wonder what our past winners are up to these days. Here's a look at what four winners experienced with the contest and what they're doing…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month16 days, 4 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question