I'll take a stab at it...

Are you closing the table, SomeTable1, and then trying to erase it within milliseconds? If the tables are located on a server (instead of your local drive) then it is likely that the server is not releasing the handle (flag, marker, user connection) on the file fast enough, and your application is trying to delete a file that the server thinks is still in use. If the SomeTable1 file is located on your local drive, then this probably wouldn't be applicable.

By the way, if you use cursors instead of tables, VFP will take care of the deletion of the files...you just create, use, and when you un-use, they're erased by Foxpro.

Free tip: Instead of the code...
          IF USED("sometable1")
               SELECT sometable1
               USE
          ENDIF
just use
          use in select('sometable1')

Mike Copeland

-------- Original Message --------
Subject: Unexplained Error 1705 "Access Denied" Errors
From: Ken Dibble <[email protected]>
To: [email protected]
Date: 7/19/2013 11:31 AM
Hi Folks,

Please check the following scenario:

This is an intermittent problem for some users but not all users. The common points are:

"Restricted" Domain Users running my application on Windows XP or Windows 7.

My application is installed in "C:\Program Files\My Application" on XP, and in "C:\My Application" on Windows 7.

The simplified code below describes a process that runs in a tight loop to create temporary tables, uses them to print a report (one report per loop), closes and erases those tables, and loops again. The reports are identical except for the data in them. There can be any number of reports; typically the number ranges between 30 and 100 per run.

I know those locations are not supposed to be writeable, but I explicitly grant "Modify" permission to the users. This enables them to do things like create subdirectories and new files, modify existing files, and delete files, in those locations. This works at least some of the time for all users, but at some times, for some users, the following happens:

LoopMethod
     Method1
          oktocontinue = .T.

* Close a bunch of temporary tables. (They ARE tables, not cursors.)
          IF Method2() = .F.
               * Display some error message.

                oktocontinue = .F.
          ENDIF

          IF oktocontinue = .T.
               * Erase the temporary tables.
               Method3()

* Code to re-create the just-closed and erased tables and populate them
               * with new data.
* These are FREE tables created in the local working directory. * At this time EXCLUSIVE is OFF, but it shouldn't matter. These tables * are only being accessed by my code in this one location at this one * time. I never use USE AGAIN. I never use multiple datasessions. I
               * never use multiple aliases for the same table.
               * etc. etc.
          ENDIF

          RETURN oktocontinue
     EndMethod1

     Method2
          IF USED("sometable1")
               SELECT sometable1
               USE
          ENDIF

          IF USED("sometable2")
               SELECT sometable2
               USE
          ENDIF

          IF USED("sometable3")
               SELECT sometable3
               USE
          ENDIF

IF USED("sometable1") OR USED("sometable2") OR USED("sometable3") * This never happens. It ought to mean the tables are closed, right? Which * means, since only this single process touches them, nobody and nothing
              * should have any kind of lock on them, right?
              RETURN .F.
         ELSE
              RETURN .T.
         ENDIF
     EndMethod2

     Method3
          ERASE sometable1.*  && BANG!! Error 1705 "File access denied."

          ERASE sometable2.*

          ERASE sometable3.*
     EndMethod3
EndLoopMethod

Can anyone explain this? What am I missing here?

Thanks for any help.

Ken Dibble
www.stic-cil.org


[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to