Deletefile Error 70
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site vba delete file permission denied About Us Learn more about Stack Overflow the company Business Learn more about runtime error 70 permission denied vba hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
Filesystemobject Deletefile Permission Denied
the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MS Access 2007 VBA
Vba Close File
FSO.DeleteFile Error 70 Permission Denyed up vote 2 down vote favorite When I try to delete a file with FSO.DeleteFile I get 'Error 70 Persmission Denyed'. When I try to use the Kill command I get 'Error 75 Path/File access error'. I have read/write privileges to the folder, though it is on a network drive not a local drive. Here's my code: Private Sub DeleteFileButton_Click() On vba delete file in folder Error GoTo Err_DeleteFileButton_Click Dim FileLocation As String Dim strSQL As String FileLocation = DLookup("AttachmentLink", "dbo_tbl208Attachments", "ATID = " & Me.lstFiles.Column(1)) strSQL = "DELETE FROM dbo_tbl208Attachments WHERE ATID = " & Me.lstFiles.Column(1) With New Scripting.FileSystemObject .DeleteFile FileLocation End With 'Kill FileLocation CurrentDb.Execute strSQL, dbFailOnError MsgBox "File has been deleted" Exit_DeleteFileButton_Click: Exit Sub Err_DeleteFileButton_Click: MsgBox Err.Number & " - " & Err.Description Resume Exit_DeleteFileButton_Click End Sub ms-access-2007 access-vba share|improve this question asked Nov 30 '12 at 21:38 Donnachaidh 5918 FileLocation holds the correct file path (I copy and pasted it into Windows Explorer and the file came up). But Dir(FileLocation) just shows the file name, nothing else. –Donnachaidh Dec 3 '12 at 20:54 I am able to delete the file from windows explorer right after the error pops up. –Donnachaidh Dec 3 '12 at 22:41 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted I've run into this before. The file I was trying to delete was hidden. You can't programmaticly delete a hidden file without unhiding it first. Try adding this sub to your code before killing the file. Sub unhideFile(filename as string) If Le
Office Applications Spreadsheets Macro to delete file? If this is your first visit, be sure to check out the FAQ. You may have to Register before you can post. Results 1 to 8 of 8 Thread: Macro to delete file? Tweet Thread Tools Show Printable Version Subscribe to this Thread… 2001-05-22,12:36 #1 dreyes View Profile View Forum Posts Visit Homepage 4 Star Lounger Join Date Jan 2001 Location Houston, Texas, USA Posts 432 Thanks 0 Thanked 0 http://stackoverflow.com/questions/13653566/ms-access-2007-vba-fso-deletefile-error-70-permission-denyed Times in 0 Posts Macro to delete file? Tried to create a macro that will delete a file. Does anyone know how to go about this using VB? Using mS Excel 97. 2001-05-22,12:43 #2 Andrew Cronnolly View Profile View Forum Posts Gold Lounger Join Date Feb 2001 Location Dublin, Ireland, Republic of Posts 2,697 Thanks 1 Thanked http://windowssecrets.com/forums/showthread.php/6980-Macro-to-delete-file 0 Times in 0 Posts Re: Macro to delete file? Try Kill Pathname where pathname is the full path and filename of the file you wish to delete, example Kill "C:My DocumentsFile1.xls" Andrew 2001-05-24,13:58 #3 dreyes View Profile View Forum Posts Visit Homepage 4 Star Lounger Join Date Jan 2001 Location Houston, Texas, USA Posts 432 Thanks 0 Thanked 0 Times in 0 Posts Re: Macro to delete file? HELP: I use MS Excel 97, Access97 Tried this your suggestion and it will not work in my case. I need to use the following network path: prodSecurityMasterTerm2001.xls I keep getting "RunTime Error: 70, Permission denied" when it comes to the KILL statement at the end. With ActiveSheet.QueryTables.Add(Connection:= _ "FINDER;tabsproddatabaseEdgarSecurityTermination.d qy", Destination:=Range("A5")) .FieldNames = True .RefreshStyle = xlInsertDeleteCells .RowNumbers = False .FillAdjacentFormulas = False .RefreshOnFileOpen = False .HasAutoFormat = True .BackgroundQuery = True .TablesOnlyFromHTML = True .Refresh BackgroundQuery:=False .SavePassword = True .SaveData = True End With Rows("5:5").Select Selection.Delete Shift:=xlUp Range("A5:F38").Select Selection.Sort Key1:=Range("D5"), Order1:=xlDescending, Key2:=Range("A5") _ , Order2:=xlDescending, Header:=xlGue
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs Channel 9 Documentation APIs and reference https://msdn.microsoft.com/en-us/library/aa264534(v=vs.60).aspx Dev centers Retired content Samples We’re sorry. The content you requested has http://www.utteraccess.com/forum/delete-file-permission-t1990519.html been removed. You’ll be auto redirected in 1 second. Reference Trappable Errors Core Visual Basic Language Errors Core Visual Basic Language Errors 70 Permission denied 70 Permission denied 70 Permission denied 3 Return without GoSub 5 Invalid procedure call or argument 6 Overflow 7 Out of memory 9 Subscript out permission denied of range 10 This array is fixed or temporarily locked 11 Division by zero 13 Type mismatch 14 Out of string space 16 Expression too complex 17 Can't perform requested operation 18 User interrupt occurred 20 Resume without error 28 Out of stack space 35 Sub, Function, or Property not defined 47 Too many DLL application clients 48 Error in loading DLL vba delete file 49 Bad DLL calling convention 51 Internal error 52 Bad file name or number 53 Can't find specified file 54 Bad file mode 55 File already open 57 Device I\O error 58 File already exists 59 Bad record length 61 Disk full 62 Input past end of file 63 Bad record number 67 Too many files 68 Device unavailable 70 Permission denied 71 Disk not ready 74 Can't rename with different drive 75 Path\File access error 76 Path not found 91 Object variable or With block variable not set 92 For loop not initialized 93 Invalid pattern string 94 Invalid use of Null 96 Can't sink this object's events because it's already firing events... 97 Can't call Friend procedure on an object that isn't an instance of... 98 A property or method call cannot include a reference to a private ... 321 Invalid file format 322 Can't create necessary temporary file 400 Form already displayed; can't show modally 422 Property not found 429 ActiveX component can't create object or return reference to this... 430 Class doesn't support Automation 432 File name or class
Custom Search UtterAccess Forums>Microsoft® Access>Access Modules Delete A File - Permission Denied Error 70, Access 2007 Forum HomeSearchHelpUA Messages|-- UtterAccess.com NewsAccess Knowledge Center|-- Access Code Archive|-- Access Knowledgebase / FAQ|-- Access TutorialsMicrosoft® Access|-- Local Access User Groups (AUGs)|-- Interface Design|-- Access Q and A|-- Access Tables + Relationships|-- Access Queries|-- Access Forms|-- Access Reports|-- Access Macros|-- Access Modules|-- Access Date + Time|-- Access Errors + Error Handling|-- Access Built-in Functions|-- Access Searching + Data Mining|-- Access Records|-- Access Security|-- Access Automation|-- Access Database Container|-- Tool bars, Menu bars + Ribbon|-- Access Services (Web Databases)|-- Access Data Access Pages (Deprecated)|-- Access Data Projects - ADP|-- Access Runtime, Packaging & DeploymentAnd More...|-- Microsoft SQL Server|-- SQL Server Reporting Services|-- Microsoft SharePoint|-- Microsoft Internet Explorer|-- Visual Basic 6 and Earlier|-- Visual Basic 2003 and Later|-- ASP and VBScript|-- Web Development|-- PHP, Perl, MySQL and Postgres|-- Other Database Engines|-- BI Tools and Applications|-- JAVA and C#|-- GraphicsMicrosoft® Office|-- Microsoft Excel|-- Microsoft Excel FAQs|-- Microsoft Word|-- Microsoft Outlook|-- Microsoft PowerPoint|-- Microsoft FrontPage/Exp. Web|-- Other Microsoft ProductsPC|-- Network Issues|-- Q & A - Hardware|-- Q & A - Software|-- Q & A - Other PC|-- Virus + Security DiscussionUtterAccess Odds and Ends|-- General Chat|-- Q & A - UtterAccess.com Forums|-- Q & A - Access Wiki Options dhappView Member Profile Jul 14 2012, 09:02 PM Post#1Posts: 1,0