Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Access Denied Error is receive 2

Status
Not open for further replies.

fjarena

MIS
Dec 1, 2000
5
US
File Access Denied Error is received when using FoxPro 2.6 and more than 1 user attempts to use a shared data base file. I understand why this would happen. My question is; How can I best faciltate the processing without an error occurring? The current processing is summarized below.

A command button starts a program that selects a record from one file (CLIENT.dbf). The program then finds any corresponding records in a second file (LEDGER.dbf). Additionally, a third file is searched for related records (PAYMENT.dbf), if any. A fourth file (SCREENPT.dbf) is zap and a record is appended for each set of related Client-Ledger-Payment information. Multiple records may exist in SCREENPT.dbf. (If no payment was made, a the payment amount is $0.0) A report (SCREENPT.frx.) is run to the printer. Data is grouped by LEDGER (number) and the report detail is the payment information for the ledger. If 2 people attempt to print the report at the same time an error results.
 
Have you SET EXCLUSIVE OFF in your environment ?. This could be the answer. ramani :-9
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
If file SCREENPT.dbf is ZAPped,
of course is locked by OS.
Its impossible at the same time append records
from others user.
Better idea is no ZAP,
rather SET FILTER to select records corresponding user.
(Or, for each user his own SCRENPTx.dbf).
Finally, SCREENPT.dbf is probably redundant...
 
Instead of SCREENPT.dbf use simply
tempor = sys(3)
use (tempor)...
 
I shall assume that SCREENPT.DBF contains records only temporarily for printing. It is this file which is creating the problem. It has to be exclusive mode when zapped and cannot be used by others. If this file is only in use for a couple of seconds (i.e. records for printing are 5 or 6 in number), you can write an error-handler routine in the program which will RETRY till the file is available for use.

However, I shall recommend use of CREATE CURSOR SCREENPT ..... in place of this file. Cursors are temporary files created for local use. Other users do not have access to it. You can APPEND, INSERT, INDEX, SELECT or do anything with cursors in the same way as DBFs. However, they are lost when closed.

It is important to use SET EXCLUSIVE OFF, as suggested by Subramanian.G, in the environment definitions at the top of the PRG. Alternatively, you can use USE with SHARED/EXCLUSIVE option.
 
Check the Share settings on the server. Set to "Full" - it may be set to "Read Only"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top