Why does a user gets a Runtime error 70 with Permission Denied when attempting to delete the XLS files in a folder C:\SENTSPRING on his local drive ?

In my Access application I use Access as the front end and SQL Server as the backend database. In a sub-procedure
I first checks to see whether or not the user has a folder on his local C: Drive and if so, delete all .XLS files within this folder.

I placed the Access adp file on a server. Then a user accesses the apd file on the server. When the application reaches the line:

     Kill "C:\SENTSPRING\*.XLS"  <--------------   this line is highlighted in yellow by the compiler

A runtime error is generated        Runtime Error 70
                                                 Permission Denied

The user does not have permission to delete the XLS files in a folder C:\SENTSPRING on his local drive.

Do you know how I can avoid this error ?

'Kill "C:\IIG\CASH_CONTROL\ccshared\AbandonedProperty\TEST\*.XLS"
    If isFileExist("C:\SENTSPRING\*.XLS") Then
       Kill "C:\SENTSPRING\*.XLS"
    End If
zimmer9Asked:
Who is Participating?
 
SidFishesCommented:
this is likely a windows permissions error.
the user will need to be given full permissions to the folder in question
0
 
christampaCommented:
is the file open?
0
 
LambertHeenanCommented:
Another reason that this error can get thrown is that the user actually has the file open in Excel when your code tries to delete it.
0
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.

All Courses

From novice to tech pro — start learning today.